[BUG] [Java][retrofit2] if YAML contains cookie parameters, retrofit doesn't omit it in api method
Created by: focuscs
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
if YAML contains cookie parameters, retrofit doesn't omit it in api method. For example ,below DefaultApi,java could have compile issue because there is an additional "," in usersGet method, it it also unreasonable there is a @param JSESSIONID, but there is no that parameter.
package org.openapitools.client.api;
import org.openapitools.client.CollectionFormats.*;
import retrofit2.Call; import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.ResponseBody; import okhttp3.MultipartBody;
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
public interface DefaultApi { /**
- Returns a list of users.
- Optional extended description in CommonMark or HTML.
- @param xApiVersion API version used by the client (required)
- @param JSESSIONID Cookie by Set-Cookie in Login method's response header (required)
- @return Call<List<String>> */ @GET("users") Call<List> usersGet( @retrofit2.http.Header("x-api-version") String xApiVersion, );
}
openapi-generator version
4.0.0-beta3
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: Sample API
description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
version: 0.1.9
servers:
- url: http://api.example.com/v1
description: Optional server description, e.g. Main (production) server
- url: http://staging-api.example.com
description: Optional server description, e.g. Internal staging server for testing
paths:
/users:
get:
summary: Returns a list of users.
description: Optional extended description in CommonMark or HTML.
parameters:
- name: x-api-version
in: header
description: API version used by the client
required: true
schema:
type: string
- name: JSESSIONID
in: cookie
description: Cookie by Set-Cookie in Login method's response header
required: true
schema:
type: string
responses:
'200': # status code
description: A JSON array of user names
content:
application/json:
schema:
type: array
items:
type: string
Command line used for generation
openapi-generator generate -g java --library=retrofit2 -i ~/Sample.yaml -o ./sample
Steps to reproduce
openapi-generator generate -g java --library=retrofit2 -i ~/Sample.yaml -o ./sample