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
  • #3248
Closed
Open
Issue created Jun 29, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][Spring] generated api interface doesn't have @RequestParam annotation

Created by: t2y

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

I updated openapi-generator from 4.0.1 to 4.0.2. Then, I found generated api interface from same spec is different between 4.0.1 and 4.0.2.

For some reason, @RequestParam is not generated for api parameters. Here is an example.

  • 4.0.1
@ApiParam(value = "", allowableValues = "json, csv, tsv", defaultValue = "json")
@Valid
@RequestParam(value = "format", required = false, defaultValue = "json")
Format format
  • 4.0.2
@ApiParam(value = "", allowableValues = "json, csv, tsv", defaultValue = "json")
@Valid
Format format
openapi-generator version

4.0.2

OpenAPI declaration file content or url
openapi: 3.0.2
info:
  title: info
  description: info
  version: 0.1.0

paths:
  /example/api:
    get:
      summary: summary
      description: description
      parameters:
      - $ref: '#/components/parameters/requiredQueryParam'
      - $ref: '#/components/parameters/formatParam'
      responses:
        200:
          description: response
          content:
            application/json:
              schema:
                type: string

components:
  parameters:
    requiredQueryParam:
      description: set query
      in: query
      name: query
      required: true
      schema:
        type: string
    formatParam:
      description: set format
      in: query
      name: format
      required: false
      schema:
        $ref: '#/components/schemas/format'

  schemas:
    format:
      default: json
      description: response format
      enum:
      - json
      - csv
      type: string
Command line used for generation
$ mvn clean package
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ./simple-example-spec/openapi.spec -g spring -o output
Steps to reproduce

Generate api code for spring with 4.0.1 and 4.0.2. Then compare the api parameters of api interface.

Related issues/PRs

I couldn't find any similar issues.

Suggest a fix
Assignee
Assign to
Time tracking