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

RFC: Feature-enabled specification variants. #370

Open
ariesclark opened this issue Jul 23, 2024 · 3 comments
Open

RFC: Feature-enabled specification variants. #370

ariesclark opened this issue Jul 23, 2024 · 3 comments

Comments

@ariesclark
Copy link
Member

ariesclark commented Jul 23, 2024

Some generators support certain syntax's that others don't, to provide the best support possible and closely model VRChat's API, relying on the most minimum support available across all generators leaves us with undesirable/broken SDKs.

I propose something similar to the following:

/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.

Resources

Originally posted by @ariesclark in vrchatapi/vrchatapi-rust#17 (comment)

Alternatives

  • Drop support for generators that don't support it.
@ariesclark
Copy link
Member Author

cc: @Foorack thoughts, concerns?

@0xkubectl
Copy link

Is there any other potential application for this besides responses?

@C0D3-M4513R
Copy link
Contributor

C0D3-M4513R commented Aug 6, 2024

Is there any other potential application for this besides responses?

This could be used to implement tag parsing too, by using one_of to either parse to an enum or a string as a fallback.

See the following commits:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants