Closed sugaaloop closed 5 months ago
The $ref for someObject works fine, but the $ref for someObject/properties/id gets corrupted by the generator. To be clear, the openapi schema is valid.
Sound like this should be an issue for the generator? Unless I'm missing something
@sugaaloop You know what, sure, why not :) Throw this in a PR and I will merge it.
Hey! Awesome library, I appreciate you building it.
We're using this with openapi-generator to build schemas/types with zod in our backend, create the openapi spec, then pull that down into the frontend to generate the axios api reference and common types. The issue is that the generator gets confused when the spec references a property on a shared schema. For instance:
The $ref for
someObject
works fine, but the $ref forsomeObject/properties/id
gets corrupted by the generator. To be clear, the openapi schema is valid.I'd rather any references only be to a schema on the top level of the components/schemas collection anyway, so my solution is to create a referenceStrategy that ignores any reference with "properties" in the path.
This seemed to work pretty well, if you're interested in it I'd be happy to put together a PR with tests and update the docs, if not I'll just use it as a patch.