Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address naming collisions in schema islands #302

Merged

Conversation

mwadams
Copy link
Contributor

@mwadams mwadams commented Mar 8, 2024

When you have schema islands (such as those in OpenApi documents), there is no guarantee that referenced schema will be in a unique namespace based on the existing heuristic.

In order to address this we have:

  • Added a check to see if the type name already exists in the discovered type declarations
  • If it does, we prepend the name derived from the path (not the fragment) if a path exists; this fixes the issue of identically named entities
  • If we still have collisions, we append a monotonically incrementing number to the type name; this deals with the situation where you have a single schema file with multiple data islands with colliding names.
  • Added a stable ordering for setting dotnet type name and namespace to ensure that the naming heuristic will be applied consistently

…d spaces

- If it does, we prepend the name derived from the path (not the fragment) if a path exists; this fixes the issue of identically named entities
- If we still have collisions, we append a monotonically incrementing number; this is where you have a schema with multiple data islands with colliding names.
- Added a stable ordering for setting dotnet type name and namespace
@mwadams mwadams linked an issue Mar 8, 2024 that may be closed by this pull request
@mwadams mwadams merged commit 4595631 into main Mar 9, 2024
5 checks passed
@mwadams mwadams deleted the feature/301-type-name-collisions-when-referencing-schema-islands branch March 9, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

array properties within allOf directives are not merged
1 participant