Fix missing model Prefix and api prefix/suffix handling, fix #414 #415

Merged
sschnabe merged 3 commits from issue-414 into main 2024-09-18 15:19:05 +02:00
sschnabe commented 2024-09-18 11:15:57 +02:00 (Migrated from github.com)
No description provided.
kokuwaio-bot (Migrated from github.com) reviewed 2024-09-18 11:15:57 +02:00
rpahli (Migrated from github.com) reviewed 2024-09-18 11:15:57 +02:00
wistefan (Migrated from github.com) reviewed 2024-09-18 11:15:57 +02:00
jfiedler-jaconi commented 2024-09-18 13:35:41 +02:00 (Migrated from github.com)

I checked out the PR branch and did a "mvn install" to produce a snapshot version of the generator for local testing against my project. Unfortunately I am not able to run the snapshot version at all for some reason.

Exception in thread "main" java.util.ServiceConfigurationError: org.openapitools.codegen.CodegenConfig: Provider org.openapitools.codegen.languages.MicronautCodegen could not be instantiated
        at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
        at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
        at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
        at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
        at org.openapitools.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:36)
        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:647)
        at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:744)
        at org.openapitools.codegen.plugin.CodeGenMojo.execute(CodeGenMojo.java:973)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
        at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
        at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
        at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
        at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
        at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:903)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:280)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:203)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.lang.NoSuchFieldError: useBeanValidation
        at org.openapitools.codegen.languages.MicronautCodegen.<init>(MicronautCodegen.java:94)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
        at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789)
        ... 33 more
I checked out the PR branch and did a "mvn install" to produce a snapshot version of the generator for local testing against my project. Unfortunately I am not able to run the snapshot version at all for some reason. ``` Exception in thread "main" java.util.ServiceConfigurationError: org.openapitools.codegen.CodegenConfig: Provider org.openapitools.codegen.languages.MicronautCodegen could not be instantiated at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586) at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813) at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729) at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403) at org.openapitools.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:36) at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:647) at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:744) at org.openapitools.codegen.plugin.CodeGenMojo.execute(CodeGenMojo.java:973) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:903) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:280) at org.apache.maven.cli.MavenCli.main(MavenCli.java:203) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314) Caused by: java.lang.NoSuchFieldError: useBeanValidation at org.openapitools.codegen.languages.MicronautCodegen.<init>(MicronautCodegen.java:94) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789) ... 33 more ```
jfiedler-jaconi commented 2024-09-18 13:45:06 +02:00 (Migrated from github.com)

I now updated to Java 21 and the latest 7.8.0 of the Maven plugin. I can confirm that the code generation then works correctly and honors the configured model prefix. Thank you very much for the fast turnaround time.

I now updated to Java 21 and the latest 7.8.0 of the Maven plugin. I can confirm that the code generation then works correctly and honors the configured model prefix. Thank you very much for the fast turnaround time.
sschnabe commented 2024-09-18 14:02:00 +02:00 (Migrated from github.com)

Java 17 is supported, but only the latest version of openapi codegen is supported (because of maintenance efforts).

Java 17 is supported, but only the latest version of openapi codegen is supported (because of maintenance efforts).
jfiedler-jaconi commented 2024-09-18 15:15:09 +02:00 (Migrated from github.com)

Do you have a rough estimate when a new release containing this fix will be available?

Do you have a rough estimate when a new release containing this fix will be available?
fabian-schlegel (Migrated from github.com) approved these changes 2024-09-18 15:19:04 +02:00
sschnabe commented 2024-09-18 20:28:31 +02:00 (Migrated from github.com)

see 4.3.1

see [4.3.1](https://github.com/kokuwaio/micronaut-openapi-codegen/releases/tag/4.3.1)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
kokuwaio/micronaut-openapi-codegen!415
No description provided.