Closed dmi3coder closed 4 years ago
@dmi3coder - we discussed this in the Microprofile OpenAPI hangout last week and found that my suggestion to open this as a specification issue was a bit misguided. This is an implementation problem and your original issue in SmallRye is the best place to continue this discussion.
Basically, the implementation should be handling the parsing of the example
string based on the type
of the enclosing schema, which was your original thought. We would only want to go down the path of using @ExampleObject
if multiple examples are necessary, and maybe not even then.
If you are in agreement, please go ahead and close this issue and we can continue working this as a change in smallrye-open-api.
@MikeEdgar sounds great, thank you
The original issue was posted here: https://github.com/smallrye/smallrye-open-api/issues/300 I have a very simple User object where I have id field of type integer. I added example with specifying the type
This generates a schema with an example as a string
Because of this in e.g Swagger UI when I'm prompted to fill in the example I have string type, users can think that it's mandatory to wrap integer into double-quotes.
By OpenAPI, an example can be any type of object(e.g integer, string, number), but currently, there's no way to specify that you want to parse this value into the required format. As I understand implementation doesn't know whether to parse this value or use it as a string.
As @MikeEdgar suggested: "Maybe the change could be to add to
@ExampleObject
a propertyboolean parseValue
and support using that annotation from@Schema
"