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.

swagger.json generate only with tags section

See original GitHub issue

Hi, I get build success, but a very partial json swagger is create. Namely it look like my @ApiOperation annotation is completely missed or ignored. When I compile I see the following print:

— swagger-maven-plugin:3.1.4:generate (default) @ backend — [INFO] Reflections took 126 ms to scan 1 urls, producing 9 keys and 12 values [INFO] Reflections took 5 ms to scan 1 urls, producing 9 keys and 12 values [INFO] Reflections took 5 ms to scan 1 urls, producing 9 keys and 12 values [INFO] Reflections took 5 ms to scan 1 urls, producing 9 keys and 12 values

Using <plugin> <groupId>com.github.kongchen</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>3.1.4</version>

Swagger annotations, swagger core and springfox

<dependency> <groupId>io.swagger</groupId> <artifactId>swagger-annotations</artifactId> <version>1.5.6</version> </dependency>
	<dependency>
		<groupId>io.swagger</groupId>
		<artifactId>swagger-core</artifactId>
		<scope>compile</scope>
		<version>1.5.6</version>
		<exclusions>
			<exclusion>
				<groupId>javax.ws.rs</groupId>
				<artifactId>jsr311-api</artifactId>
			</exclusion>
		</exclusions>
	</dependency>

	<dependency>
		<groupId>io.springfox</groupId>
		<artifactId>springfox-swagger2</artifactId>
		<version>2.6.1</version>
	</dependency>

And My code: ` @Api(tags = “Greetings”, description = “Greeting Resource”) @RestController @RequestMapping(value = “api/greetings” , produces = “application/json”) public interface GreetingsController {

@ApiOperation(value = "Get your greeting here", response = GreetingResource.class)
@RequestMapping(value = "" , method = RequestMethod.GET)
GreetingResource getGreetings();

} `

when I run my app and check /api-docs - I see the correct full json.

Please help

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thlaeglercommented, Aug 22, 2017

Since it looks like you are using Jax/RS, try instead of @RequestMapping(value = “/”)

@RequestMapping(path = “/”)

0reactions
nikhil4326commented, Oct 16, 2017

Thanks, that helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grouping Operations With Tags - Swagger
For example, Swagger UI uses tags to group the displayed operations. ... and externalDocs for each tag by using the global tags section...
Read more >
Swagger Codegen Documentation
The Swagger Codegen is an open source code-generator to build server stubs and client SDKs directly from a Swagger defined RESTful API. The...
Read more >
Configuration - Swagger Documentation
Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and...
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
Such an update MUST only require changing the openapi property to the new minor ... Tags MUST be limited to those allowed by...
Read more >
Data Models (Schemas) - Swagger
OAS 3 This guide is for OpenAPI 3.0. Data Models (Schemas). OpenAPI 3.0 data types are based on an extended subset JSON Schema...
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