title: OpenAPI / Swagger 3.0: Default discriminator value
body: <p>How do you set a default discriminator for each child class?</p>
  <p>For example, take this schema:</p>
  <pre><code>components:
    schemas:
      Pet:
        type: object
        required:
        - petType
        properties:
          petType:
            type: string
        discriminator:
          propertyName: petType
      Cat:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Cat`
          properties:
            name:
              type: string
      Dog:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Dog`
          properties:
            bark:
              type: string
  </code></pre>
  <p>Code-generators for the above schema will create a client where the <code>petType</code> value must be explicitly set by the programmer. Why can't the <code>Cat</code> object have the <code>petType</code> be set to <code>Cat</code> by default?</p>
  <p>I tried using <code>default</code> value to get it to work. However, the resulting code includes shadowed properties (same property on the child and parent).</p>
  <pre><code>components:
    schemas:
      Pet:
        type: object
        required:
        - petType
        properties:
          petType:
            type: string
        discriminator:
          propertyName: petType
      Cat:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Cat`
          properties:
            name:
              type: string
            petType:
              type: string
              default: 'Cat'
      Dog:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Dog`
          properties:
            bark:
              type: string
            petType:
              type: string
              default: 'Dog'
  </code></pre>
  <p>Removing the property <code>petType</code> from the parent also doesn't feel right since technically it's more of a property of the parent than the child.</p>
  <pre><code>components:
    schemas:
      Pet:
        type: object
        required:
        - petType
        discriminator:
          propertyName: petType
      Cat:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Cat`
          properties:
            name:
              type: string
            petType:
              type: string
              default: 'Cat'
      Dog:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Dog`
          properties:
            bark:
              type: string
            petType:
              type: string
              default: 'Dog'
  </code></pre>
  <p>Do you have any solutions to this problem?</p>