OpenAPITools / OpenAPITools/openapi-generator
Custom Template
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Hi Team , I am trying to use the custom template to generate the APIException Code but not able to generate any file . There is no error in CLI Console. Please can you help what wrong I am doing-
Here is my template copied from JavaSpring folder-
package {{apiPackage}};
import {{javaxPackage}}.annotation.Generated;
/**
-
The exception that can be used to store the HTTP status code returned by an API response.
/
{{>generatedAnnotation}}
public class ApiException extends Exception {
/* The HTTP status code. /
private int code;
/*- Constructor.
- @param code The HTTP status code.
- @param msg The error message.
*/
public ApiException(int code, String msg) {
super(msg);
this.code = code;
}
/**
- Get the HTTP status code.
- @return The HTTP status code.
*/
public int getCode() {
return code;
}
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
}
And Command used-
java -jar openapi-generator-cli-6.2.1.jar generate -g spring -i todo.yaml -o openapicodenew --artifact-id openapi-spring-boot --group-id com.test --additional-properties configPackage=com.test.configuration --model-package com.aws.model --api-package com.test.api --library spring-boot -t ./template
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied openapi-generator-cli 6.2.1 generate command with todo.yaml and inspect the openapicodenew output. Compare the ./template contents with the JavaSpring folder, focusing on the custom ApiException template, and determine why no file is generated. Done means the reproduction is explained and the expected generated file behavior is confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100