Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #11163
Closed
Open
Issue created Dec 21, 2021 by Administrator@rootContributor

[BUG][Java Spring OAS3] Invalid allowable values generated for enum path variables

Created by: whydoievenneedthis

Description

Enum path variables with java spring oas3 option are generated incorrectly.

openapi-generator version

5.3.1

OpenAPI declaration file content
openapi: 3.0.3
info:
  title: Api Documentation
  description: Api Documentation
  termsOfService: urn:tos
  contact: {}
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0
  version: '1.0'
paths:
  /thingy/{type}:
    get:
      operationId: get
      parameters:
        - name: type
          in: path
          description: type
          required: true
          schema:
            $ref: '#/components/schemas/Periodicity'
      responses:
        '200':
          description: OK
components:
  schemas:
    Periodicity:
      type: string
      enum:
        - MORNING
        - EVENING
        - DAILY
        - WEEKLY
        - BIWEEKLY
        - MONTHLY
Generation Details

Generator name: spring Config options: oas3 = true

Generated java code

The following code fragment is generated with the oas3 option turned on:

@Parameter(
  name = "type",
  description = "type",
  required = true,
  allowableValues = "MORNING, EVENING, DAILY, WEEKLY, BIWEEKLY, MONTHLY"
)
Expected java code
@Parameter(
  name = "type",
  description = "type",
  required = true,
  schema = @Schema(allowableValues = "MORNING, EVENING, DAILY, WEEKLY, BIWEEKLY, MONTHLY")
)
Assignee
Assign to
Time tracking