Hi
@OA\Property(
property="locations",
type="array",
example=["Germany", "France"],
@OA\Items(
type="string"
)
)
Hi, this code sample returns an error when swagger docs say that it should be possible https://swagger.io/docs/specification/adding-examples/
Is there any way to provide an array as example for array data type?
the [] notation is wrong, it should use {} in PHPDOC.
Works, thanks
How do you handle example with multiple values ?
That works to me
@OA\Property(
property="locations",
type="array",
example={"Germany", "France"},
@OA\Items(
type="string"
)
)
ok ... and what about more example with multiple values ? :smiley: #inception
In OpenAPI 3 you have example which is a totally freeform key you can put anything into, but you also have examples which has a slightly more strict format (for parameters for instance).
Most helpful comment
In OpenAPI 3 you have
examplewhich is a totally freeform key you can put anything into, but you also haveexampleswhich has a slightly more strict format (for parameters for instance).http://spec.openapis.org/oas/v3.0.3#fixed-fields-9