-
Notifications
You must be signed in to change notification settings - Fork 24
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
Draft implementation for Issue #204 (Swagger/Openapi: Multipart/form-data multiple file request support ) #205
Conversation
…to specify format for array items
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great for the most part.
I think this is blocked by #201 as mentioned in the comments.
Once we resolve a way to support type variants (nullable, overriden format, etc. etc.) then we should be able to ship this right after
String::class -> cache[clazz.simpleName!!] = SimpleSchema( | ||
"string", | ||
format = type.findAnnotation<Format>()?.format | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worries me, for the same reason explained in #201
I believe if we do this, Kompendium will think every string should have the overridden format. The reason it works currently is that constraints are applied after the cache is generated, and prior to actual spec generation.
This would introduce formatting at the cache level, so every request to the cache for "String" would get back a string with a binary format.
I've been chewing on ways to tackle #201, haven't come up with anything good yet it's a rather ugly problem to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh.. you right... damn.. will re-think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you remove this, and then in the constraint scanner, check not just on the field but on the type, then we may be able to do this prior to fixing #201 outright.
kompendium-core/src/test/resources/formatted_array_item_type.json
Outdated
Show resolved
Hide resolved
This looks great! Think you just need to resolve a conflict in the constraint scanner, add a line to the CHANGELOG, then we'll merge this and I'll cut a release branch later today :) |
# Conflicts: # kompendium-core/src/main/kotlin/io/bkbn/kompendium/core/constraint/ConstraintScanner.kt
would be great to cover scanner by tests.. but... let's wait for your big changes |
Here is the draft PR to support Format specification of an array items.
This fixes #204