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
  • #2908
Closed
Open
Issue created May 16, 2019 by Administrator@rootContributor

[BUG] [JAVA | JAXRS-Spec] Cookie in parameter is not correctly generated

Created by: grantsunny

Description

When trying to do code generation with cookie in parameter yaml file, uncompilable code are being generated and generator does not report error.

openapi-generator version

openapi-generator-maven-plugin 4.0.0

OpenAPI declaration file content or url
  /products:
    get:
      tags: 
        - products
      summary: List all products
      operationId: listProducts
      parameters:
        - in: cookie
          name: debug
          schema:
            type: string
            default: ""
        - in: query
          name: page
          description: Specify which page shall be returned. Default value is 0.
          required: false
          schema:
            type: integer
            format: int32
            default: 0
Command line used for generation
			<plugin>
				<groupId>org.openapitools</groupId>
				<artifactId>openapi-generator-maven-plugin</artifactId>
				<version>4.0.0</version>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.basedir}/src/main/resources/email-api.yaml</inputSpec>
							<generatorName>jaxrs-spec</generatorName>
							<configOptions>
								<java8>true</java8>
								<dateLibrary>java8</dateLibrary>
								<interfaceOnly>true</interfaceOnly>
								<useSwaggerAnnotations>false</useSwaggerAnnotations>
								<generatPom>false</generatPom>
							</configOptions>
							<output>${project.basedir}</output>
							<apiPackage>...</apiPackage>
							<modelPackage>...</modelPackage>
						</configuration>
					</execution>
				</executions>
			</plugin>
Steps to reproduce

Using maven to trigger the generation. While I believe this is something to do with generator itself instead of the maven plug-in.

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/2689 I believe this is related but not same generator.

Suggest a fix

So far the generated code is like this

    @GET
    @Produces({ "application/json" })
    List<Product> listProducts(, @QueryParam("page")  @DefaultValue("0")   Integer page);

And it shall be like tihs

    @GET
    @Produces({ "application/json" })
    List<Product> listProducts(@CookieParam("debug") String debug, @QueryParam("page")  @DefaultValue("0")   Integer page);
Assignee
Assign to
Time tracking