question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Empty" swagger.json File

See original GitHub issue

I am using version 3.1.0 of the swagger-maven-plugin with the following configuration: <plugin> <groupId>com.github.kongchen</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>3.1.0</version> <configuration> <apiSources> <apiSource> <springmvc>true</springmvc> <locations>my.api.location</locations> <schemes>http</schemes> <host>myhost</host> <basePath>/api</basePath> <info> <title>Title</title> <version>v1</version> <description>Description</description> </info> <swaggerDirectory>my/directory</swaggerDirectory> </apiSource> </apiSources> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>

When I run mvn compile the swagger.json file generated contains only the basic information, IE the info, host, basepath, and schemes. It does not contain any information about my API.

I am using io.swagger v1.5.3 The annotations is similar to this @API(value = "value", tags = {"tag"}, hidden = false)

When checking the debug logs I see the following message: [INFO] Reflections took 136 ms to scan 1 urls, producing 38 keys and 349 values

I am able to compile the example project with the correct swagger.json so it shouldn’t be an issue due to my maven version.

Am I missing something or could this be a bug.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
nwagg14commented, Jul 8, 2016

So my problem was that I didn’t have a @ApiOperation on my methods. If anyone else is having this problem, ensure you have @RequestMapping on all methods AND your class, and that you have @ApiOperation for every method, not just @ApiResponse

1reaction
jivimbergcommented, Mar 14, 2017

I was experiencing the same in a multi module maven setup. In my case what fixed it was to add the direct dependency from the module where the plugin is defined to the module containing the resources. It didn’t pick it up through the transitive dependency. Don’t know if this is a bug or the expected behavior. My 2 cents, hope it helps you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Empty swagger.json generated using swagger-maven-plugin ...
json file. This is a part of multi module project where am getting an error. Adding the same dependencies and process in a...
Read more >
OpenAPI Specification - Version 2.0 - Swagger
By convention, the Swagger specification file is named swagger.json . ... An empty value MAY be used to clear the global definition.
Read more >
Get started with Swashbuckle and ASP.NET Core
Configure method, enable the middleware for serving the generated JSON document and the Swagger UI: C# Copy. public void ...
Read more >
Empty object in response in Swagger ui - SmartBear Community
Empty object in response in Swagger ui ... My swagger YAML is: ... 'Passed in parameters for: test' content: application/json: schema: $ref: ...
Read more >
Swagger in ASP.NET Core: Tips & Tricks - George Kosmidis
By default, Swashbuckle generates and exposes Swagger JSON in version 3.0 of the ... you first need to enable the creation of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found