Skip to content

feat: Add errorUnions feature testing endpoint #30

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

Closed

Conversation

bflad
Copy link
Member

@bflad bflad commented May 22, 2025

Copy link

linear bot commented May 22, 2025

@bflad
Copy link
Member Author

bflad commented May 22, 2025

Turns out the other /errors/{status_code} endpoint can already work for this -- so if you see this you're probably looking for the errors-union-of-errors and errors-union-of-errors-discriminated tests and this OAS

  /errors/500#errorUnion:
    servers:
      - url: http://localhost:35456
    post:
      operationId: errorUnionPost
      tags:
        - errors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  x-speakeasy-name-override: errorType1RequestBody
                  properties:
                    error:
                      type: string
                  required:
                    - error
                - type: object
                  x-speakeasy-name-override: errorType2RequestBody
                  properties:
                    error:
                      type: object
                      x-speakeasy-name-override: errorType2Message
                      properties:
                        message:
                          type: string
                      required:
                        - message
      responses:
        "200":
          description: OK
        "500":
          $ref: "components.yaml#/components/responses/errorUnionResponse"
  /errors/400#errorUnionDiscriminated:
    servers:
      - url: http://localhost:35456
    post:
      operationId: errorUnionDiscriminatedPost
      tags:
        - errors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  x-speakeasy-name-override: taggedError1RequestBody
                  properties:
                    tag:
                      type: string
                    error:
                      type: string
                  required:
                    - tag
                    - error
                - type: object
                  x-speakeasy-name-override: taggedError2RequestBody
                  properties:
                    tag:
                      type: string
                    error:
                      type: object
                      x-speakeasy-name-override: taggedError2Message
                      properties:
                        message:
                          type: string
                      required:
                        - message
                  required:
                    - tag
                    - error
      responses:
        "200":
          description: OK
        "4XX":
          $ref: "components.yaml#/components/responses/errorUnionDiscriminatedResponse"

@bflad bflad closed this May 22, 2025
@bflad bflad deleted the bflad/gen-1461-feature-support-errorunions-feature-in-php branch May 22, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant