1

I'm trying to use the swagger-codegen-maven-plugin to generate Java code for an OpenAPI specification which contains the following declaration:

type: object
properties:
  state:
    type: string
    enum:
      - aborted
      - finished
additionalProperties:
  type: string
required:
  - state

Somehow, the generated class is missing the state property, but is simply derived from HashMap:

public class MyObject extends HashMap<String, String>  {

   // hasCode(), equals() and toString() methods omitted for brevity
}

Is there any way to make the plugin generate a class that implements both the state property and an additional list of dynamic properties?

priderider
  • 21
  • 1
  • Does this answer your question? [How to define map in swagger.yaml?](https://stackoverflow.com/questions/60256066/how-to-define-map-in-swagger-yaml) To recap - it's a codegen issue, https://github.com/swagger-api/swagger-codegen/issues/5187 – Helen Jul 03 '20 at 16:46

0 Answers0