OpenAPITools / OpenAPITools/openapi-generator
Unable to migrate from swagger-codegen due to removed method in CodegenModelFactory
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
I'm currently migrating from swagger-codegen 2.3.1 to openapi-generator 4.3.1 and I came into a big problem. We have a highly customized generator and templates, and I'm currently stuck on a method that was removed with https://github.com/OpenAPITools/openapi-generator/pull/1744. We use this to add more fields into Operations and Properties so that they can be used on the mustache templates.
How can I overcome this drawback?
public class MyJavaJerseyServerCodegen extends JavaJerseyServerCodegen
{
...
public void processOpts(){
...
CodegenModelFactory.setTypeMapping(CodegenModelType.OPERATION, MyCodegenOperation.class);
CodegenModelFactory.setTypeMapping(CodegenModelType.PROPERTY, MyCodegenProperty.class);
...
}
...
}
public class MyCodegenOperation extends CodegenOperation {
public String entryPointResponseModel;
public boolean supportError501;
...
public boolean hasNonCookieHeaders;
public boolean hasHeaders;
public MyCodegenOperation()
{
super();
}
}
openapi-generator version
4.3.1
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 reading CodegenModelFactory and the change linked as pull request 1744, then inspect JavaJerseyServerCodegen, CodegenOperation, and the custom CodegenModel mappings shown in the issue. Determine a supported replacement for extending operations and properties in version 4.3.1, and document or test how custom fields remain available to the mustache templates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100