Comments (2)
Of note, this also happens if you have i.e.
data Foo = Bar | ... | Wrong A A
because it generates
value:
items:
- $ref: '#/components/schemas/Day'
- $ref: '#/components/schemas/Day'
maxItems: 2
minItems: 2
type: array
instead of
value:
items:
$ref: '#/components/schemas/Day'
maxItems: 2
minItems: 2
type: array
from openapi3.
There is a comment regarding this:
Warning: OpenAPI 3.0 does not support tuple arrays. However, OpenAPI 3.1 will, as it will incorporate Json Schema mostly verbatim.
As example:
ghci> :m Data.OpenApi Data.OpenApi.Schema Data.Aeson.Encode.Pretty Data.Proxy Data.ByteString.Lazy.Char8
ghci> Data.ByteString.Lazy.Char8.putStrLn $ encodePretty $ toSchema $ Proxy @(Int, Bool)
{
"items": [
{
"maximum": 9223372036854775807,
"minimum": -9223372036854775808,
"type": "integer"
},
{
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2,
"type": "array"
}
This is valid per draft7 JSON Schema - I've checked here.
However, latest OpenAPI references 2020-12 draft: https://spec.openapis.org/oas/latest.html#schema-object.
And per the latter prefixItems
should be used instead.
Could you check whether schema is accepted (and validation works correctly both in negative and positive scenarios) if to replace problematic items
with prefixItems
?
If yes I believe one needs to bring these lines in sync with JSON Schema spec (note that there is inference between items
, prefixItems
, unusedItems
). Though additional questions is which version of OpenAPI this library targets.
from openapi3.
Related Issues (20)
- `encodePretty` should be exposed from `Data.OpenApi`
- Invalid schema with types with primes (`'`)
- Generic polymorphic schema handle lists differently to aeson HOT 2
- Outdated documentation re sum encoding differs ToSchema/ToJSON? HOT 1
- Wrong format when generating empty scopes map HOT 2
- Exception when parsing newer OpenApi3 schemas HOT 4
- Add `nullable` attribute HOT 4
- _OpenApiItemsArray and _OpenApiItemsObject should be Prisms, not Reviews
- invalid schema HOT 1
- SecurityDefinitions missing "Index" and "IxValue" type family instances
- SecurityDefinitions missing "Ixed" and "At" type-class instances
- Allow GHC-9.6
- Mismatch between ToJSON and ToSchema with nullary single-record constructor
- How to implement allOperations for optics? HOT 2
- Hardcoded references
- add `ToSchema Schema` instance
- validateJSON semantics with `allOf` seem incorrect
- Why are the schemas different for `ToParamSchema UUID` and `ToSchema UUID`
- Prefix stripping when a `$ref` is parsed as a `Referenced` is confusing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi3.