[Kotlin] add apiSuffix configuration#2690
Conversation
|
Can someone please give me a clue about the issue with ci/circleci ? |
|
For the last build, it looks like a CircleCi cache issue may be a core member can trigger a build without cache. But for the first error, you must regenerate all impacted sample (R, c#, go...) |
|
it seem like there's a regression with your change when apisuffix is not set : for example FakeApi become Fake. Thats'why you have a lot of error with sample regenerate checking shell in Cirecle/CI. |
| protected Set<String> languageSpecificPrimitives = new HashSet<String>(); | ||
| protected Map<String, String> importMapping = new HashMap<String, String>(); | ||
| protected String modelPackage = "", apiPackage = "", fileSuffix; | ||
| protected String modelPackage = "", apiPackage = "", apiSuffix = "", fileSuffix; |
There was a problem hiding this comment.
you forgot to define the default value of apiSuffix :
apiSuffix = "Api"
that should resolve your CIRCLE/CI errors
| return "DefaultApi"; | ||
| } | ||
| return camelize(name) + "Api"; | ||
| return (this.apiSuffix.isEmpty() ? camelize(name) : camelize(name) + this.apiSuffix); |
There was a problem hiding this comment.
that would be great to remove the toApiName overriding method in AbstractJavaCodegen class to be able to have this feature in most of java generators
|
Thanks for the help and code review! |
|
@fj-roman thanks for adding the functionality 👍 @karismann thanks for the review. From what I understand, apiSuffix is added as a global option but only the Java generators support this option so far. Instead of making it a global option from day one, what about adding the option only to the Java generators (Abstract Java class) to start with? In other words, |
|
@wing328 fair point. My main focus is to provide this feature for the KotlinSpringServerCodegen. I will refactor the the PR to move this feature to the AbstractKotlinCodegen. Maybe I can provide it to all Kotlin generators within one PR. Should I close this PR and open later a new one, or should I just edit the description after I complete the refactoring? |
|
@fj-roman why closed the PR? |
|
Tested locally and it works as expected 👍 |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,. Default:3.4.x,4.0.xmaster.@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog
Description of the PR
Add an option to configure a suffix of generated API classes. Default suffix is still API.