-
Notifications
You must be signed in to change notification settings - Fork 84
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
Support for primitive arrays (fixes #55) #56
Support for primitive arrays (fixes #55) #56
Conversation
some comments:
{
"name": "id",
"in": "path",
"description": "ID of pet to use",
"required": true,
"type": "array",
"items": {
"type": "string"
}
} with this, there is no need to tune the here's a commented (let [[paths definitions] (-> swagger
; this is responsible for ensuring schema names for deeply nested schemas (to support properties)
ensure-body-and-response-schema-names
; here's the beef (including extracting parameters)
(extract-paths-and-definitions options))] , so I would dig in from for there, there seems to guards like "the body model should have a schema": (if-let [schema (rsc/peek-schema model)] ; checks that there is valid reference within , which could say ".. or it's a primitive array". So, all changes could be done sorry for the bad docs and looking forward to this change! |
Thanks for taking the time to look this over @ikitommi - I hope I haven't nuked my local branch of ring-swagger with a billion I should have some time to look at this this weekend, I'll make the |
If parameters are Swagger-specific, won't that make array schemas invisible to validators treating Swagger spec as standard JSON schema? Shouldn't properties be used instead? (this is in fact a vaguely concealed attempt to ping involved parties because I want this fixed but I'm not sure if I can do it myself) |
* Replaces #56 * Fixes #55 * Fixes metosin/compojure-api#177
SORRY for keeping you waiting. This got buried under everything :( But should be now fixed in |
Ok, after much scratching my head I've come up with this fix for #55. It works for what I need it to do, which is generating schemas for lists of primitives as body or response parameters.
One thing it doesn't currently do is refer back to schema names that define lists of primitives; instead it will copy them into the parameter definition. I left some commented code in a test that demonstrates this. I may spend a bit of time trying to fix that, but the rest of the PR seems useful enough that I'm submitting it as-is for now. Please let me know if there's anything you'd like me to change.