-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Clarify: "type": "string", "format": "binary" in non-entity-body #1544
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
Comments
In recent versions of JSON Schema, this is handled by https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8 These concepts have been part of JSON Schema since before OpenAPI, but under various names and at times in the Hyper-Schema spec (despite having nothing to do with hyperlinks) |
How do we describe binary data with a non empty schema?
|
@spacether
The JSON Schema Validation spec also notes: "As "base64" is defined in both RFCs, the definition from RFC 4648 SHOULD be assumed unless the string is specifically intended for use in a MIME context." To transfer a binary resource, |
@spacether I'm not sure you need a non-empty schema, btw, as the A schema for a binary resource definitely should not have |
So I am concerned with defining schemas in a location dependent context in v3.1.0
When that schema is there under a json key, it means that all json types are accepted there. Looking at the content map definition one can do this:
Schemas can be $ref to other components. This lack of clarity makes it unclear how to implement tooling (code generation) for v3.1.0 |
It is not location-sensitive. The comment about multipart responses has to do with OpenAPI's Encoding Object, which is an are of considerable complexity outside the scope of JSON Schema. |
The context here is openapi. If one location allows ingestion and transmission of binary using AnyType schema and another location allows ingestion of different data with that same schema definition it looks location or maybe media type key sensitive to me. |
The AnyType schema literally allows everything. There is nothing strange about it being used in different locations that, through other aspects of OpenAPI, further constrain what is allowed. The schema behaves the same everywhere your example uses it. |
Okay then per that logic then binary content can be stored in any empty schema definition. If one does that and and attempts to be send that data as application/json then serialization of that data would fail. Is that what you envision that implementors should do? |
Filed #3024 for discussion at the meeting tomorrow. |
@pbryan I think we should indeed clarify that |
PRs merged for 3.0.4, with analogous PRs merged for 3.1.1 and 3.2.0 - closing! |
It would be good to clarify how implementations should handle "format": "binary" when the value expressed in a JSON representation (i.e. not encoded directly in the entity-body).
The choices I see:
The text was updated successfully, but these errors were encountered: