-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Support for CBOR #3108
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
Do you mean support for requestBodies and responses in CBOR format, or exchanging OAS document instances encoded as CBOR? What changes in the specification do you think might be warranted? https://spec.openapis.org/oas/latest.html#format
There is some discussion about CBOR for both representing JSON Schema instances and the object models they operate on over at the JSON Schema spec repo, such as json-schema-org/json-schema-spec#6 |
I was thinking about request and response bodies. |
As long as bi-directional mapping can be established beween the JSON Schema model and the CBOR model (such as the implicit JSON<=>YAML mapping, or the JSON<=>XML mapping which is supported by the JSON Schema also distinguishes between |
Hinting would probably be needed for binary data since is raw. There is only one binary data format. |
The proposal to loosen the coupling between the OAS and JSON Schema in Moonwalk as noted in the recent "Moonwalk in 2024" blog post could theoretically allow using CDDL with Moonwalk when describing CBOR payloads. Which seems like the best way to support it. I'm not sure there's much that could be done in an OAS 3.2 other than what @MikeRalphson already suggested, which is define a mapping to the JSON Schema data model and maybe use extension keywords in the schema for hinting. |
I also think CDDL is a fantastic way to bridge openapi and CBOR data. Would be great to have native support for CDDL generation from schema. (maybe there is already? Anyone know?) |
@mkschreder the idea of supporting it in 4.0 "Moonwalk" is mentioned here (it does not yet have its own discussion): |
If there will be CBOR support in Open API. it should be restricted to deterministic encoding: |
I have used EJSON from the Meteor project. It has been around for quite a while. It only encodes If the schema could be augmented, then Swagger UI could have a plugin that allows a conversion of an annotated JSON or EJSON object to CBOR before the call, and convert the returned valuea from annotated JSON or EJSON. Ecerything starts with the spec, though. |
I have after almost a decade with JSON, decided to use CBOR as the foundation for new designs (except for browser-based applications where the JavaScript/JSON combo still makes sense).
The rationale is here: https://github.com/cyberphone/cbor-everywhere
The text was updated successfully, but these errors were encountered: