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

[BUG] RequestBodies schema type conflicts with the header #656

Closed
zelinh opened this issue Nov 6, 2024 · 5 comments
Closed

[BUG] RequestBodies schema type conflicts with the header #656

zelinh opened this issue Nov 6, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@zelinh
Copy link
Member

zelinh commented Nov 6, 2024

What is the bug?

Separate from #633

For example /_bulk, we specify the requestBodies for bulk as an array which conflicts with the application/x-ndjson format, which uses newline-delimited JSON rather than a JSON array.

Ref:

content:
application/x-ndjson:
schema:
type: array

What is the expected behavior?

We should specify whichever schema for application/x-ndjson as a String.

@Xtansia
Copy link
Collaborator

Xtansia commented Nov 6, 2024

We need to represent the structure that is being returned or accepted by the API. It is an array of objects, just encoded in a certain manner, which is indicated by what the content type is.
This is not much different to the way things like XML would be represented: https://swagger.io/docs/specification/v3_0/data-models/representing-xml/

@dblock
Copy link
Member

dblock commented Nov 7, 2024

@Xtansia Are you seeing this is a non-issue and represented correctly? @zelinh do you disagree? otherwise close this?

@zelinh
Copy link
Member Author

zelinh commented Nov 7, 2024

@Xtansia Thanks for the reply. While I think the correct structure to represent this should be String. As we specify it as Newline delimited JSON, It's slightly different from the simple array or json structure. This can cause error when we run any schema validation.

@Xtansia
Copy link
Collaborator

Xtansia commented Nov 7, 2024

@zelinh Which schema validation are you referring to? It is still structured data not a plain string, and the encoding is determined by what the content type is, which any validation or (de)serialization must take into account. Otherwise this also applies to cbor & smile.

Additionally we need the structure information for client code generation.

@zelinh
Copy link
Member Author

zelinh commented Nov 8, 2024

I see. Thanks for the context here. I think we could close out this issue then as this is by design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants