-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Array of response object in schema.yaml / schema.json does not result in array type in schema.d.ts #1421
Comments
I think the Or if that property really is polymorphic, then I’d suggest moving the |
@drwpow thanks. In my case the property is polymorphic. So this is basically not part of the specification? Baeldung seems to confidently use it that way and this site is pretty reliable, which is wondering me now.
Could you please show me how exactly that would look like in my schema? Not sure how it would project to the Java implementation. Would I have to annotate the base class then with |
Ah I got it backwards—it’s your items that are polymorphic and not the top-level property. I’m not too familiar with that Java library you’re using, but you’ll need to have the |
So if we adjusted your original code, this is how it should look: "SomeResponseObject": {
"type": "object",
"properties": {
"page": {
"format": "int64",
"type": "integer"
},
"pages": {
"format": "int64",
"type": "integer"
},
"items": {
"type": "array",
"items": {
- "$ref": "#/components/schemas/ResponseListItem"
+ "oneOf": [
+ {"$ref": "#/components/schemas/ResponseListItem"},
+ {"$ref": "#/components/schemas/SomeItem"},
+ {"$ref": "#/components/schemas/SomeOtherItem"}
+ ]
},
- "oneOf": [
- {"$ref": "#/components/schemas/SomeItem"},
- {"$ref": "#/components/schemas/SomeOtherItem"}
- ]
}
}
} |
This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem. |
Description
Array type of response object does not result in array type in schema
will result in
Which does not represent the array but just a single item.
I've run Redocly and there are some issues, but nothing related to the object I'm referring to.
BTW the openapi.json / yaml is autogenerated by my Quarkus Application and this is the originating Java class:
I'm using
Expected result
(in case it’s not obvious)
Checklist
npx @redocly/cli@latest lint
)The text was updated successfully, but these errors were encountered: