-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
openapi3: introduce ReferencesComponentInRootDocument(doc *T, ref componentRef) (string, bool)
#945
openapi3: introduce ReferencesComponentInRootDocument(doc *T, ref componentRef) (string, bool)
#945
Conversation
Hello! Note: the |
Yes, if it also returned the name in the #components/schemas/... Input: doc, Schema I'll have a look at moving it out of the gen'ed file |
I've moved the alternations out of the code gen'ed files, sorry I'm still getting familar with the project setup and just thrown everything in the helper file. I'd like to ad some unit tests of couse but hopefully this is more to your liking. |
3897eef
to
11a0e6f
Compare
This is looking pretty good! |
Things to do:
Heads up I'll be away for 10 days, so I won't be developing this PR for a bit |
It does this by keeping track of the source file paths of schemas in multi-file'd specs. This enables the amalgamation of schemas which reference the same underlying model which removes *very annoying* to use anonymous structs in generated models when using codegen tools like oapi-codegen.
And populate all ref types
8de52a7
to
c3fe41b
Compare
Address most of the bullet points. Where is the best place for the example? Edit: Added an example to the READMD.md |
ReferencesComponentInRootDocument(doc *T, ref componentRef) (string, bool)
This MR adds a function (
ReferencesComponentInRootDocument
) to check if a component reference references the same document or element as another component reference in the root document's#/components/<type>
. If it does, it returns the name of it in the form#/components/<type>/NameXXX
.It does this by keeping track of the source file paths of schemas in multi-file'd specs.
This enables the amalgamation of schemas which reference the same underlying model which removes very annoying to use anonymous structs in generated models when using codegen tools like oapi-codegen.
TODO:
add MR in oapi-codegen displaying improved model generation.oapi-codegen/oapi-codegen#1573