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.

Programmatically add ApiDescription with JSON request body

See original GitHub issue

We are using Springfox 2.9.2. Our application has Spring Security enabled so I am wanting to advise Springfox of the authentication methods that our API exposes.

We have POJOs for both input and output for our authentication API, and the spring security layer handles conversion of these objects to/from JSON for the client. However these are not automatically added to the Swagger doc because they are not in a controller.

I’m trying to find out how to inject the request/response detail to the documentation. Based on this comment and related documentation page, I can see that I need to implement ApiListingScannerPlugin to build the ApiDescription. I can’t find any way to specify the request input/body, as the Swagger documentation describes.

Any info on how to manually expose these API details (and related request/response objects) would be greatly appreciated. Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rrathod05commented, Jul 20, 2018

I have similar problem when I adding global error response message.

responseMessages.add(new ResponseMessageBuilder()
				.code(HttpStatus.BAD_REQUEST.value()).message(HttpStatus.BAD_REQUEST.getReasonPhrase() + " - Returns when <br> invalid request received (i.e. request is in not expected format) <br>"
						+ "validation fails <br> business error occurs.")
				.responseModel(new ModelRef("ErrorResponse"))
				.build());

capture

Console log image

0reactions
stale[bot]commented, Jul 8, 2020

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plumber: getting request body/schema in UI - Stack Overflow
I was hoping to see a Request body with "edit value" and "schema" options. plumber.R #* @apiTitle test API #* @apiDescription an api...
Read more >
Accepting Raw Request Body Content in ASP.NET Core API ...
Lets start with a non-raw request, but rather with posting a string as JSON since that is very common. You can accept a...
Read more >
Using OpenAPI and Swagger UI - Quarkus
You just need to add the openapi extension to your Quarkus application: ... You can request the OpenAPI in JSON format using the...
Read more >
Generating Swagger example requests with Swashbuckle
My ExamplesOperationFilter populates the “example” property of a schema object in the swagger json. Thus in order to have an “example” a ...
Read more >
Using the API | Google API Discovery Service
Basic API Description; Authentication; Resources and schemas ... to the API are unauthenticated, JSON-based, REST requests that use SSL, ...
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