Skip to content

Discriminator property case not transformed #216

@aabounegm

Description

@aabounegm

I have an OpenAPI schema that makes use of type discriminator, but that property is preserved as is and is not transformed according to the properties option.

For example, let's say the schema looks like this:

openapi: "3.1.0"
info:
  title: Discriminator casing bug
  version: "1.0.0"
paths: {}
components:
  schemas:
    CatEvent:
      type: object
      properties:
        event_type:
          type: string
          const: "CAT"
        full_name:
          type: string
    DogEvent:
      type: object
      properties:
        event_type:
          type: string
          const: "DOG"
        breed:
          type: string
    AnimalEvent:
      oneOf:
        - $ref: "#/components/schemas/CatEvent"
        - $ref: "#/components/schemas/DogEvent"
      discriminator:
        propertyName: event_type

And my casing-config.yaml is simply:

properties: camelCase

In the output, event_type in the properties correctly gets transformed to eventType, but the discriminator property name is preserved as event_type, even though such property no longer exists on the schema.
The expected output is for discriminator.propertyName to also get converted to camelCase and become eventType

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions