-
Notifications
You must be signed in to change notification settings - Fork 11
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
Patch OpenAPI spec instead of writing custom code #17
Conversation
The dart package used to do this, so I see no issue |
We could add this to the specification repository and, during bundling, create two specs. Generators that support oneOf can then use the feature-enabled spec. |
Something like: /auth/user:
get:
summary: Login and/or Get Current User Info
tags:
- authentication
x-codeSamples:
$ref: "../codeSamples/authentication.yaml#/~1auth~1user/get"
responses:
'200':
x-feature:
key: oneOf
schema:
oneOf:
- $ref: ../responses/authentication/CurrentUserLoginResponse.yaml
- $ref: '#/components/schemas/TwoFactorRequired'
fallback:
$ref: ../responses/authentication/CurrentUserLoginResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml then during bundling/building, we're turn this into two specification files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You include way to much changes here.
I split off the avoidBoxedModals and formatting into seperate pr's.
Making the .unwrap()
into a .expect()
and the example change together could be a seperate change.
- add fmt after generate run - add set -eux -o pipefail for better logs
4ed0136
to
ddc9fd2
Compare
I think fixing this here is not a good solution at this point in time and is not implemented in a clean way. Closing for now. |
In #12 custom code was introduced to fix vrchatapi/specification#241.
I have opened vrchatapi/specification#352, but we noticed that some of the generators do not support the
oneOf
. Its reasonable to assume that this is on hold until upstream generators of all supported languages can deal withoneOf
.This change generates code that is similar to what was added manually but does this via patching the spec instead. IMHO this a more maintainable way of achieving the same goal. Please give feedback.
EDIT: Based on these DC Messages: One, Two
I opted to use JSONPatch instead of a regular patch as it was mentioned they are quite hard to maintain.