-
-
Notifications
You must be signed in to change notification settings - Fork 243
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 "examples" annotations #23
Comments
This isn't yet supported, but this is a sensible enhancement that I'll definitely consider implementing. This would probably work by creating a function that returns the example value and setting it in an attribute, the same way serde's default attribute works, for example:
|
thanks for your encouraging answer!
yes i already have to use this mechanism in my actual code to set some boolean an enum defaults, but i have to say, it's a rather inconvenient and unwieldy solution. using some kind of markup in the docstring would IMHO be more comfortable and suitable in this particular case, but at the end i would just appreciate any clever support resp. real world implementation of this feature. |
This is implemented in schemars v0.7.6, which is now published to crates.io |
@GREsau |
Did not spot this feature at first. But nice to see it come 😃
I am far from an expert on openapi so could be wrong. I find this helpful to see the structure: http://openapi-map.apihandyman.io/ Edit: Just found this: GREsau/okapi#11 (comment) That confirms it, maybe it should be handled there. |
is there any support for
examples
annotation entries available in schemars and how to realize this kind of augmentation with serde resp. docstrings or anything similar?unfortunately i couldn't find anything about this kind of non-validation oriented auxiliary annotations in the present schemars documentation and examples.
The text was updated successfully, but these errors were encountered: