Skip to content

Stabilize Model Naming and Import Mappings for Consistent Client Generation #6

@bsayli

Description

@bsayli

Summary

Stabilize model naming and import mappings to ensure deterministic, consistent client generation across builds and services.

Details

Currently, the project produces clean and type-safe client models.
However, when multiple OpenAPI specs or dynamic vendor extensions (x-api-wrapper, x-page, etc.) are involved, client generation can lead to non-deterministic output — causing unnecessary file diffs or class renames between regenerations.

This can happen when:

  • Package paths or generator configs differ between services.
  • modelNameSuffix or modelNamePrefix are omitted.
  • import-mappings or type-mappings change across builds.
  • Vendor extensions are generated dynamically at runtime (e.g. via Springdoc).

Proposed Direction

  • Lock naming conventions via consistent modelNameSuffix and modelNamePrefix.
  • Define stable import-mappings and type-mappings for shared types.
  • Keep vendor extension ordering deterministic.
  • Optionally, add a CI check to detect unexpected model count changes.

Benefits

  • Deterministic client generation across builds and services.
  • Cleaner diffs and more reliable version control.
  • Improved multi-service consistency in large-scale ecosystems.

Originated from community feedback on r/microservices.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions