openapi-tools / swagger-maven-plugin

Maven plugin to activate the Swagger Core library to generate OpenAPI documentation.
MIT License
70 stars 45 forks source link

Cannot invoke "java.util.Map.size()" because "map" is null #116

Open nobody102 opened 7 months ago

nobody102 commented 7 months ago

wildfly 27. Using swagger maven plugin, with JDK 21, and getting the above error.

io.openapitools.swagger swagger-maven-plugin com.hsntech.bannerjwt.rest ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version} openapi JSON YAML true /SecurityService/rest Endpoint URL for Banner Security Service API's Security Service - OpenAPI 1.0.0 REST API Framework designed to allow third party vendors the ability to access Banner client data without having to go through the Banner UI Framework. generate maven-dependency-plugin ${maven-dependency-plugin.version} prepare-package unpack org.webjars swagger-ui ${swagger-ui.version} ${project.build.directory}/swagger-ui org.apache.maven.plugins maven-war-plugin ${maven-war-plugin.version} ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version} **/*.* swagger-ui com.google.code.maven-replacer-plugin replacer ${replacer.version} prepare-package replace ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/index.html http://petstore.swagger.io/v2/swagger.json openapi.yaml
salake commented 7 months ago

Same issue here

ataraxus commented 5 months ago

Same here

ataraxus commented 5 months ago

Ah got it, used already jakarta but this plugin searches for javax :/

dgautier commented 4 months ago

@ataraxus seems to be quite annoying, anybody knows about someone fixing this ?

prabhat2020 commented 3 months ago

@ataraxus so this library can't be used to generate for jakarta apis.Did you got any other plugin to generate open api spec

ataraxus commented 3 months ago

I wrote a custom plugin. My API Definitions are in a separate Module and my plugin, stubs them all during compiletime and generates the openApi spec using this plugin.

bdevos commented 2 months ago

I do not know if this is the exact issue we ran into, but it sounds so similar that maybe this info helps.

We saw this exact same error and the reason seems to be that when there are no classes with @Path annotations in the package defined in <resourcePackage> of the plugin.

At first I thought the workaround was adding more <resoucePackage> to the plugins config, but we just needed to add the following to the config:

<useResourcePackagesChildren>true</useResourcePackagesChildren>
mali30 commented 2 months ago

I wrote a custom plugin. My API Definitions are in a separate Module and my plugin, stubs them all during compiletime and generates the openApi spec using this plugin.

Could you share that custom plugin that you wrote or atleast a working example. I am running into this issue now and it seems like the fix hasn't been merged yet by the mainainer.

mali30 commented 2 months ago

I do not know if this is the exact issue we ran into, but it sounds so similar that maybe this info helps.

We saw this exact same error and the reason seems to be that when there are no classes with @Path annotations in the package defined in <resourcePackage> of the plugin.

At first I thought the workaround was adding more <resoucePackage> to the plugins config, but we just needed to add the following to the config:

<useResourcePackagesChildren>true</useResourcePackagesChildren>

I tried this but it didn't work for me unfortunantly.

traviscollins commented 1 month ago

Same issue in JDK 17