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

Generated typeables should contain discriminator field if specified #113

Closed
danslapman opened this issue Aug 15, 2019 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@danslapman
Copy link
Collaborator

Example from https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/:

paths:
  /pets:
    patch:
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/Cat'
                - $ref: '#/components/schemas/Dog'
              discriminator:
                propertyName: pet_type
      responses:
        '200':
          description: Updated
components:
  schemas:
    Pet:
      type: object
      required:
        - pet_type
      properties:
        pet_type:
          type: string
      discriminator:
        propertyName: pet_type
    Dog:     # "Dog" is a value for the pet_type property (the discriminator value)
      allOf: # Combines the main `Pet` schema with `Dog`-specific properties 
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Dog`
          properties:
            bark:
              type: boolean
            breed:
              type: string
              enum: [Dingo, Husky, Retriever, Shepherd]
    Cat:     # "Cat" is a value for the pet_type property (the discriminator value)
      allOf: # Combines the main `Pet` schema with `Cat`-specific properties 
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Cat`
          properties:
            hunts:
              type: boolean
            age:
              type: integer
@danslapman danslapman self-assigned this Aug 15, 2019
@danslapman danslapman added the bug Something isn't working label Aug 15, 2019
@danslapman danslapman reopened this Sep 9, 2020
danslapman added a commit to leviysoft/typed-schema that referenced this issue Sep 9, 2020
danslapman added a commit to leviysoft/typed-schema that referenced this issue Sep 9, 2020
danslapman added a commit to leviysoft/typed-schema that referenced this issue Sep 10, 2020
danslapman added a commit to leviysoft/typed-schema that referenced this issue Sep 17, 2020
danslapman added a commit to leviysoft/typed-schema that referenced this issue Sep 17, 2020
danslapman added a commit to leviysoft/typed-schema that referenced this issue Sep 17, 2020
danslapman added a commit to leviysoft/typed-schema that referenced this issue Sep 17, 2020
Odomontois pushed a commit that referenced this issue Sep 17, 2020
Add discriminator property to generated typeables. Fix #113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant