Comments (7)
It is intended to work with JAX-RS annotations - the same as Swagger basically. But shouldn't be throwing around NPE's anyway :)
from swagger-maven-plugin.
Thanks for reporting this. While this should certainly not happen it seems to be a result of no endpoints being discovered. Do you have any JAX-RS annotated resources in com.example.my.service.common
or com.example.my.service.controller
?
I'll make sure we do a NPE for this. The 2.1.3 introduced sorting of the resource paths (and other things) to ensure a deterministic output from running the generation and this indeed seems to be an issue from the sorting when no resource paths has been discovered.
from swagger-maven-plugin.
No, I don't have any JAX-RS annotated resources. I thought maybe this plugin would work with @Api* annotated classes, now I know it doesn't.
from swagger-maven-plugin.
Before hitting #96 I was running into this issue, but I cannot really tell at what point unfortunately. This definitely is affecting a couple of folks.
Edit: Could reproduce by just using it:
<plugin>
<groupId>io.openapitools.swagger</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.1.4</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
I'm using JAX-RS.
from swagger-maven-plugin.
It looks like resourcePackage
is not recursive?
That may be a common misconception and then nothing gets picked up, resulting in the NPE.
I find it irritating that there is not activity on this project?
I would glady prefer this plugin over smallrye-open-api
plugin since this plugin picks up the Swagger Annotations.
(I am yet to compare the YAML output to see which works better - especially for generating client code).
As for the NPE, my fix was to actually configure resourcePackage
explicitly to the packages containing class files with annotations (assuming that resourcePackage
does not recurse).
Caused by: java.lang.NullPointerException
at java.util.TreeMap.putAll (TreeMap.java:312)
at java.util.TreeMap.<init> (TreeMap.java:185)
at io.openapitools.swagger.OpenAPISorter.sortPaths (OpenAPISorter.java:50)
at io.openapitools.swagger.OpenAPISorter.sort (OpenAPISorter.java:41)
at io.openapitools.swagger.GenerateMojo.execute (GenerateMojo.java:127)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:210)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:195)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
at java.lang.Thread.run (Thread.java:829)
from swagger-maven-plugin.
With 2.1.2 version, the result is only this:
openapi: 3.0.1
info:
title: My Title
description: My Descrition
version: 1.0.0
With 2.1.3 up to 2.1.5, the result is Nullpointer
.
from swagger-maven-plugin.
I had similar issue at java.util.Map.size(),
switching to 2.1.2 resolved the issue.
Now I have swagger.json generated as annotated in the @OpenAPIDefinition
{
"openapi" : "3.0.1",
"info" : {
"title" : "OpenAS2 ",
"description" : "OpenAS2 OpenAPI Implementeation",
"version" : "1.0.0"
},
"servers" : [ {
"url" : "http://localhost:8080/api",
"description" : "Test server",
"variables" : { }
} ]
}
from swagger-maven-plugin.
Related Issues (20)
- End of life? HOT 1
- Generate failed: Cannot invoke "java.util.Map.size()" because "map" is null HOT 6
- Hii,
- Cannot invoke "java.util.Map.size()" because "map" is null HOT 10
- Creating component definition
- Support for Swagger 1.x annotations HOT 1
- Problem at generation of security scheme HOT 4
- New release request: Latest Swagger version 2.1.7
- NullPointerException in 2.1.6 HOT 4
- Supporting API generation from Webflux Functional Endpoint HOT 2
- OpenApi documentation converts byte[] in array of byte[] HOT 3
- Bug related to endpoints with the same path but different consumes (produces) HOT 4
- Add the ability to not include all resources
- Ability to use wildcards in resourcePackages HOT 5
- Supporting multiple apiSources
- Problem implementing oauth security scheme HOT 1
- Examples containing date-time strings are not quoted in YAML output
- Running plugin returns the error "Scanner SubTypesScanner was not configured" HOT 7
- Mojo not marked as thread-safe
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-maven-plugin.