-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Sub-refs in external refs results in incorrect and broken imports in generated models #968
Comments
After further investigation, I'm now sus on the remapping that occurs in the json-schema-ref-parser - it seems to dereference external refs differently to internal ones, and returns $ref pointers to specific fields rather than inventory entities. It might be correct for that project, but isn't handled correctly by the getModel function that isn't expecting a $ref to a field. Would a potential solution be to add another branch to the I feel like the solution is probably in json-schema-ref-parser. Add some mechanism to stop it remapping externals so differently? Not sure 🤷 |
+1 I'm getting the same issue with nested referenced schemas. |
@caseyfw @ritchieanesco this sounds like a
And see the resulting spec file (dereferenced and remapped) Docs for the bundle method: https://apitools.dev/json-schema-ref-parser/docs/ref-parser.html#bundleschema-options-callback |
I've forked repo and used |
Using a ref to refer to an object in a secondary file, that also uses refs to refer to other sibling objects results in strange incorrect imports in generated models.
For example, given the following spec:
and the following secondary file:
Results in the following model with an import referencing a non-existent file:
I'd like to resolve this myself, but have no idea where to start - I looked into the ref parser, but it seems to be returning a correct inventory. If you could nudge me in the right direction, I'm happy to do the legwork.
Thanks @ferdikoomen !
The text was updated successfully, but these errors were encountered: