Skip to content
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

Default value of @ArraySchema violates OAS 3.0 #3859

Open
tkalmar opened this issue Jan 20, 2021 · 1 comment
Open

Default value of @ArraySchema violates OAS 3.0 #3859

tkalmar opened this issue Jan 20, 2021 · 1 comment

Comments

@tkalmar
Copy link

tkalmar commented Jan 20, 2021

I can specify the default value for an @ArraySchema with f.e.

@ArraySchema(arraySchema = @Schema(defaultValue =  "123"))

The OAS3.0 states
default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.

So a default value of type String is wrong for any schema which is not of type string (array, int ...)
I can not specify an array of default values for the array schema
To make it worse, if i read the spec correctly if the items in the array are of type int i should specify an array of ints, when the item type is array i should specify an array of arrays ...
This has an impact on real life projects, as can be seen on:
springdoc/springdoc-openapi#1010

@christopher-cudennec
Copy link
Contributor

Any news here? I'd also be interested in a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants