Open Zomzog opened 2 years ago
When a path or query param has enum constraint, it is generated as String. We need to generate it as an enum.
Last from master
--- openapi: "3.0.1" info: title: "My Little Pony" description: "Friendship is magic" contact: {} version: "1.0.0" paths: /ponies: summary: "Everything for ponies" get: summary: "List" operationId: "list" parameters: - name: "name" in: "query" required: false schema: type: "string" enum: - "Big McIntosh" - "Rainbow Dash" - "Pinkie Pie" - "Rarity" responses: 200: description: "Status 200" content: application/json: schema: type: "array" items: $ref: "#/components/schemas/Pony" 400: description: "Status 400" components: schemas: Pony: type: "object" properties: Id: type: "string"
Spring generator with spring-boot library https://github.com/OpenAPITools/openapi-generator/blob/master/bin/configs/spring-boot-delegate.yaml
this is actually a bug https://swagger.io/docs/specification/data-models/enums/#:~:text=request%20parameter%20or%20a%20model%20property
Bug Report Checklist
Description
When a path or query param has enum constraint, it is generated as String. We need to generate it as an enum.
openapi-generator version
Last from master
OpenAPI declaration file content or url
Generation Details
Spring generator with spring-boot library https://github.com/OpenAPITools/openapi-generator/blob/master/bin/configs/spring-boot-delegate.yaml
Steps to reproduce
Related issues/PRs
Suggest a fix