0

I'm using the following

        <plugin>
            <groupId>io.swagger.codegen.v3</groupId>
            <artifactId>swagger-codegen-maven-plugin</artifactId>
            <version>3.0.42</version>

In my Swagger plugin configuration, I have set

        <configuration>
                <additionalProperties>
                    <additionalProperty>useTags=true</additionalProperty>
                    <additionalProperty>errorOnUnknownEnum=true</additionalProperty>
                </additionalProperties>

and in my Swagger doc, I have defined a DTO with an enum type

openapi: 3.0.1
info:
   version: 1.0.0
   title: LinkFundingArrangementBankAccount Specification
   description: LinkFundingArrangementBankAccount API Services
   ...
  schemas:
    MySimpleDTO:
      type: object
      description: my object
      properties:
    ...
          type: string
          $ref: '#/components/schemas/MyEnumType'
    ...
    MyEnumType:
       type: string
       enum: [SNAP, CRACKLE, POP] 

but whe I submit a DTO to my endpoint with a different value (e.g. "ACK"), I don't get any error back from the endpoint (I would expect a 422 or 400). What else do I need to do to configure my plugin such that it respects the "errorOnUnknownEnum" property?

Dave
  • 15,639
  • 133
  • 442
  • 830

0 Answers0