openapi-eller icon indicating copy to clipboard operation
openapi-eller copied to clipboard

Discriminator field with explicit mapping does not generate wrapper type

Open udoprog opened this issue 7 years ago • 0 comments
trafficstars

On openapi-eller 0.3.1, the following:

---
openapi: 3.0.0
info: {}
servers:
  - url: "http://example.com"
paths:
  /tagged:
    get:
      operationId: get_tagged
      description: Endpoint to retrieve a single tagged interface.
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Tagged"
components:
  schemas:
    Tagged:
      oneOf:
        - $ref: "#/components/schemas/TaggedFoo"
      discriminator:
        propertyName: type
        mapping:
          foo: "#/components/schemas/TaggedFoo"
    TaggedFoo:
      type: object
      required:
        - type
      properties:
        type:
          type: string

Results in the following warning:

warn: Found unhandled entity 'components.schema.Tagged'

And a Tagged type does not seem to be generated.

udoprog avatar Aug 20 '18 17:08 udoprog