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.

Feature - Generate Docs For Services Without Swagger Annotations

See original GitHub issue

My team is using this plugin in one of our projects, and we’ve been very pleased with it. One of the features we really appreciate is the ability for the plugin to use reflection as a fallback in cases where a service doesn’t have very good Swagger documentation.

With that said, we would like to expand this plugin to support older services that aren’t using Swagger annotations at all. Since the plugin already has robust support for reflection, I think this this would be a pretty simple task. Instead of scanning for classes with @Api and methods with @ApiOperation, we would scan for @Path and @GET, @PUT, etc. (for JAX-RS) or @RestController and @RequestMapping (for SpringMvc).

Does the team feel like this would be a useful feature and within the project’s scope? I know that Swagger is the industry standard and most developers should be using it, but my team would like to be able to support services that (for whatever reason) have chosen not to use Swagger.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
packleadercommented, Aug 2, 2017

@who @kongchen Can you weigh in on this? I have a solution for this and can submit a PR. Essentially, my solution would scan for all classes annotated with @Path (for JAX-RS) or @RestController (for Spring MVC) and add them to the doc, treating @Api and @ApiOperation as optional.

0reactions
ketanprajapati88commented, Feb 5, 2020

@packleader , I am looking for same feature. I can see PR is merged, is this available in version 3.1.0?

I have classes annotated with @Service and @Path annotations but still, swagger is not generating without adding @Api annotation to class. Do we need that?

My existing classes have @Service annotation from Spring and @Path annotation from Javax.rs. and I tried springmvc as both true and false but that didn’t worked.

@Path("/test")
@Service
public class TestImpl implements Test {

    @GET
@Path("/endpoint1")
@Produces(MediaType.APPLICATION_JSON)
@Override
public Response endpoint1() throws Exception{
     }

}

Am I missing anything in configuration or this is still an issue? I am fine to annotate classes with @Api annotation but can’t annotate every single method with @ApiOperation annotation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make it possible to disable generation of swagger annotations
We are using openapi-generator-maven-plugin to generate Java classes from swagger files. We are not using swagger but Spring rest template + ...
Read more >
Customizing your auto-generated Swagger Definitions in 1.5.x
The extension annotation allows you to add extension properties to a Swagger definition. It is currently supported within the @ApiOperation, @ ...
Read more >
10 Best API Documentation Tools for 2022 [+Why Use One]
Let's take a look at some API documentation tools that offer this functionality and more. API Documentation Tools. Postman; SwaggerHub; Redocly ...
Read more >
Generating REST API documentation with OpenAPI - IBM
You can generate your REST API documentation by using the openapi-3.0 feature, which supports the OpenAPI specification. Document your REST APIs, specify public ......
Read more >
Using OpenAPI and Swagger UI - Quarkus
Now you do not need to use the @Operation annotation. While generating the document, the method name will be used for the Operation...
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