-
-
Notifications
You must be signed in to change notification settings - Fork 437
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
Cannot create a useable schema #288
Comments
What's When your code doesn't do what you expected, it's simpler to cut it in smaller and smaller parts and to verify what happens v should happen at these boundaries. Start with largeish parts then go finer. |
I don't get your answer, the only reason I wrote a larger piece of my code is to provide context, the only part I have problem with is the generated schema from my object created by What I ideally want for the {
"content": {
"application/json": {
"schema": {
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
}
}
}
} The comment on package // Package openapi3gen generates OpenAPI 3 schemas for Go types. I want to build an openapi schema for my existing structure |
Wow haha I did not realize this package was part of this very repo! kin-openapi/openapi3gen/openapi3gen_test.go Lines 25 to 61 in d4df86a
|
I did have a look at for ref := range gen.SchemaRefs {
ref.Ref = ""
} After removing the refs it generates what I expected. This package is nice but finding your way around is not that intuitive especially when I feel like one of the very few to generate schema from code instead of the opposite xD |
PRs welcomed. If you can open a PR with your example code as a test or as an example I'll get it merged. |
I am taking the reverse road most usually take by generating openapi3 documentation from a minimal http framework on top of chi, the start was pretty fast and I can generate everything I need for the request path arguments but I am stuck trying to generate a schema for the
requestBody
of an operation, my best attempt so far is:Aside from being really verbose (there may be faster way to do things but that's the best I found for now) this works but generates:
this cause the viewers to try and request
<my-domain>/string
and i am not sure what I missed, from what I understand internal references should start with "#" but I see no way of influencing what ref are generated and I feel my lack of familiarity with openapi3 does not help xDAny help or pointer in the right direction will be greatly appreciated :)
The text was updated successfully, but these errors were encountered: