-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
New Compact API Format #309
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # .pkg # .pkg.lock # modules/intermodal/src/eval/comparator/intermodal_comparator.cc
felixguendling
approved these changes
Apr 26, 2023
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new JSON format for the Web API. The current format remains supported. Also adds internal APIs to the OpenAPI spec.
Currently, the response format is automatically determined based on the request format.
Breaking change: For GET requests or when the request message cannot be parsed, the new compact format is now returned.
The new format should enable better OpenAPI and JSON Schema support and more compact API requests and responses.
TODO:
Add an option to chose the desired response format. Needed for GET requests, parse errors etc. (Maybe an URL parameter like-> Probably not needed?format=X
?)TypeScript generator (optional)-> maybe later"additionalProperties": true
is now set explicitly. Although this is the default value, some tools such as the OpenAPI Generator incorrectly usefalse
as default (see theirdisallowAdditionalPropertiesIfNotPresent
option). With this change, the generated code should now accept additional properties by default.Supported Formats
The following formats are supported:
Default FlatBuffers (Current API)
POST /anywhere
(HTTP target is ignored)Request:
Response:
Type Tags in Unions (New)
POST /anywhere
(HTTP target is ignored)Request:
Response:
The
_type
fields are only included in union fields.Type Tags in Unions + Content Only (New Default Format)
POST /paxmon/status
(HTTP target specifies the message target/API endpoint)Request:
Response:
OpenAPI
Since types can be used in unions (in which case they have a
_type
field) and outside of unions (in which case they don't have a_ type
field), two different schemas are required for types that are used in both scenarios. If a type is used in a union, aT
is appended to the name (e.g. Station -> StationT). Only the required types are generated (e.g. for the top-level message types, only types with theT
suffix are generated).