Replies: 4 comments 8 replies
-
Beta Was this translation helpful? Give feedback.
-
The openapi generator does not generate bindings, it generates a complete project structure. Modify the I think I tested the generator for the "maven integration" usecase and had a solution for this, I'll check my notes on monday. |
Beta Was this translation helpful? Give feedback.
-
I am pretty sure that it is configured correctly and it works sometimes as you can see on one of picture that it is correctly visible. I know that openapi-generator-maven-plugin generates weird structure but it is configured that sources are in |
Beta Was this translation helpful? Give feedback.
-
I simplified this and (I think) fixed it: --- a/src/main/java/com/example/generatesources/GenerateSources.java
+++ b/src/main/java/com/example/generatesources/GenerateSources.java
@@ -1,17 +1,11 @@
package com.example.generatesources;
-import com.example.client.domain.PetDTO;
-import com.example.openapi.client.api.PetApi;
+import org.openapitools.model.PetDTO;
public class GenerateSources {
public static void main(String[] args) {
- MapstructMapper mapper = new MapstructMapperImpl();
- mapper.map(new Bar());
+ new PetDTO();
System.out.println("Hello World!");
- PetApi petApi = new PetApi();
- PetDTO petDTO = new PetDTO();
- petDTO.setName("Test");
- petApi.addPet(petDTO);
}
}
--- a/pom.xml
+++ b/pom.xml
@@ -76,29 +76,7 @@
</configOptions>
</configuration>-->
<executions>
- <execution>
- <id>openapi-server</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <generatorName>spring</generatorName>
- <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
- <generateSupportingFiles>true</generateSupportingFiles>
- <generateApiDocumentation>true</generateApiDocumentation>
- <generateModels>true</generateModels>
- <generateModelTests>false</generateModelTests>
- <generateApiTests>false</generateApiTests>
- <modelNameSuffix>DTO</modelNameSuffix>
- <output>${project.build.directory}/generated-sources</output>
- <configOptions>
- <sourceFolder>openapi</sourceFolder>
- <useJakartaEe>true</useJakartaEe>
- </configOptions>
- </configuration>
- </execution>
-
<execution>
<id>openapi-client</id>
<goals>
@@ -111,15 +89,17 @@
<library>restclient</library>
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
<generateSupportingFiles>true</generateSupportingFiles>
- <generateApiDocumentation>true</generateApiDocumentation>
+ <generateApiDocumentation>false</generateApiDocumentation>
<generateModels>true</generateModels>
<generateModelTests>false</generateModelTests>
<generateApiTests>false</generateApiTests>
+ <generateModelDocumentation>false</generateModelDocumentation>
<modelNameSuffix>DTO</modelNameSuffix>
- <output>${project.build.directory}/generated-sources</output>
+ <output>${project.build.directory}/generated-sources/democlient</output>
+ <supportingFilesToGenerate>ApiClient.java,Authentication.java,HttpBasicAuth.java,HttpBearerAuth.java,ApiKeyAuth.java,OAuth.java,JavaTimeFormatter.java,RFC3339DateFormat.java</supportingFilesToGenerate>
<configOptions>
- <sourceFolder>openapi</sourceFolder>
\ No newline at end of file
+ <sourceFolder>./</sourceFolder>
\ No newline at end of file
<useJakartaEe>true</useJakartaEe>
</configOptions>
</configuration>
Note: For NB25 and lombok read #8221 Unless more arguments are made, I don't see an issue and will move this to discussion. |
Beta Was this translation helpful? Give feedback.
-
Apache NetBeans version
Apache NetBeans 24
What happened
I still have some issues with generated sources from annotation processors or openapi-generator-maven-plugin. I am pretty sure that everything is configured correctly and sometimes it works. But sometimes it is completely broken and I am not able to fix it. Generated source folders are correctly visible in projects but if I try to open them but there are empty.
I checked netbeans log and I see that there were indexed:
For example
target\generated-sources\openapi
So it scanned correctly 42 new files but it is not loaded and editor does not see these classes:
but the class is there:
Sometimes it helps to delete their target folder and then delete Netbeans cache or build a project from the command line. But I have some other projects that cannot be fixed anymore but they worked fine in the past and nothing regarding generating sources was not changed.
See the correctly loaded generated sources:

Here is a testing project with Lombok, Mapstruct and openapi-generator-maven-plugin:
GenerateSources.zip
Language / Project Type / NetBeans Component
Java Maven Project
How to reproduce
I do not know how to reproduce it because the same project worked ok one day ago and stopped working without any change only by rebuilding.
Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows 11
JDK
Adoptium 21
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
I would like to enable some debug logging but I do not have any idea what to enable and what to monitor.
Are you willing to submit a pull request?
No
Beta Was this translation helpful? Give feedback.
All reactions