We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For given open-api spec, when generating client code for Retrofit2 library, The generated code or documentation is incorrect.
There are methods/classes missing or the generated markdown documentation is incorrect.
Using Generator version 4.2.3 installed via homebrew
Using the below fromParameter.yaml spec file, I am generating a retrofit2 based client library
fromParameter.yaml
openapi: 3.0.0 servers: - url: "localhost:8080" info: version: 1.0.0 title: OpenAPI Petstore license: name: Apache-2.0 url: "https://www.apache.org/licenses/LICENSE-2.0.html" paths: /get_path_style: get: operationId: getFormStyleParamMethod parameters: - in: query name: styleQPName style: form schema: type: object properties: queryParmObjField1: type: string responses: "200": description: OK /get_path_explode: get: operationId: getExplodingParmMethod parameters: - in: query name: explodingQPName style: form explode: true schema: type: object properties: queryParamObjExplodedField1: type: string responses: "200": description: OK
This generates Documentation in docs folder with a file DefaultApi.md and the details for usage shows the sample as below but that is incorrect
docs
DefaultApi.md
// Import classes: import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; import org.openapitools.client.models.*; import org.openapitools.client.api.DefaultApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost:8080"); DefaultApi apiInstance = new DefaultApi(defaultClient); ExplodingQPName explodingQPName = new ExplodingQPName(); // ExplodingQPName | try { apiInstance.getExplodingParmMethod(explodingQPName); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#getExplodingParmMethod"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } }
Configuration.java
setBasePath(String urlbase)
APIClient.java
openapi-generator generate -i fromParameter.yaml -c codegen-config.json -g java -o sources/clients/java/
the codegen-config.json is as follows
{ "dateLibrary": "java8", "delegatePattern": true, "hideGenerationTimestamp": true, "java8": true, "library": "retrofit2" }
Language - Java Library - Retrofit2
The text was updated successfully, but these errors were encountered:
@ShahBinoy thanks for reporting the issue. May I know if you've time to contribute the fix? I can show you some good starting points.
Sorry, something went wrong.
@wing328 I can try, Please guide me through the starting points
No branches or pull requests
Bug Report Checklist
Description
For given open-api spec, when generating client code for Retrofit2 library,
The generated code or documentation is incorrect.
There are methods/classes missing or the generated markdown documentation is incorrect.
openapi-generator version
Using Generator version 4.2.3 installed via homebrew
OpenAPI declaration file content or url
Using the below
fromParameter.yaml
spec file, I am generating a retrofit2 based client libraryThis generates Documentation in
docs
folder with a fileDefaultApi.md
and the details for usage shows the sample as below but that is incorrectConfiguration.java
class generatedsetBasePath(String urlbase)
method present onAPIClient.java
classCommand line used for generation
openapi-generator generate -i fromParameter.yaml -c codegen-config.json -g java -o sources/clients/java/
the codegen-config.json is as follows
Language - Java
Library - Retrofit2
Steps to reproduce
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: