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
  • #6799
Closed
Open
Issue created Jun 28, 2020 by Administrator@rootContributor2 of 6 checklist items completed2/6 checklist items

[BUG] [SPRING] not able to get example value in @ApiParam when it is defined in spec

Created by: ashimjk

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 am not able to get an example value in @ApiParam when I tried to generate spring code.

OpenAPI declaration file content
openapi: 3.0.1
info:
  title: Swagger Petstore
  version: 1.0.0
tags:
  - name: pet
    description: Everything about your Pets
paths:
  '/pet/{petId}/{petId2}':
    get:
      tags:
        - pet
      summary: Find pet by ID
      description: Returns a single pet
      operationId: getPetById
      parameters:
        - name: petId
          in: path
          description: ID of pet to return
          required: true
          schema:
            type: integer
            format: int64
            example: 12
        - name: petId2
          in: path
          description: petId2
          required: true
          schema:
            type: string
            example: ashim
      responses:
        '200':
          description: successful operation
          content: {}
Command line used for generation
docker run --rm \
    -v $PWD:/local openapitools/openapi-generator-cli generate \
    -i /local/petstore.yaml \
    -g spring \
    -o /local/out/spring
Steps to reproduce

After the code generation, there is no example in PetApi for petId and petId2.

https://github.com/ashimjk/openapi-ex

Assignee
Assign to
Time tracking