feat!: move virtual schemas #398
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this is an annoying but necessary change that is blocking a number of improvements.
in essence we are moving the responsibility for generating "virtual schemas", ie: giving a name to otherwise anonymous entities into the
Inputclass, and making theOpenapiLoaderinstance private, as it always should've been.this is a step towards more clearly delimiting between the internal domain model and the external (eg: OAS) domain model, which is going to unlock improvements to support for 3.1 / 3.2 functionality.
unfortunately, this also identified that there were some inconsistencies in the names being generated, and despite my best efforts I wasn't able to come up with a clean way to preserve the original names.
given that it was going to be a breaking change anyway, I've doubled-down a bit and allowed myself to further change the names, notably omitting the media type if only a single media type is defined by the specification in that context (eg: there is no ambiguity by omitting it)
this change also "unwraps" some types that were adding needless indirection, eg:
will now just directly reference
SomeModelwhere needed.whilst not yet exposed through the CLI, it also internally introduces a
SyntheticNameGeneratorinterface that will later be exposed in some way to allow users to customize the names generated going forward.BREAKING CHANGE: generated names of some output types/schemas have changed, sorry