Coder Social home page Coder Social logo

Comments (7)

langecode avatar langecode commented on June 26, 2024 1

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.

langecode avatar langecode commented on June 26, 2024

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.

aortiztala avatar aortiztala commented on June 26, 2024

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.

JonasCir avatar JonasCir commented on June 26, 2024

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.

in-fke avatar in-fke commented on June 26, 2024

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.

luizleiteagrotis avatar luizleiteagrotis commented on June 26, 2024

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.

apeiris avatar apeiris commented on June 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.