DEV Community

Discussion on: Logging all request mappings and their parameters in Spring

Collapse
 
verley93 profile image
Devlin Verley II

You may be able to consider OpenAPI a scalable alternative. See below for more details.

build.gradle

implementation 'org.springdoc:springdoc-openapi-ui:1.5.0'
Enter fullscreen mode Exit fullscreen mode

OR

pom.xml

   <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-ui</artifactId>
      <version>1.5.0</version>
   </dependency>
Enter fullscreen mode Exit fullscreen mode

Then you automagically gain access to the Swagger UI and the API Docs, which may be accessed (while the app is running) at server:port/swagger-ui.html and server:port/v3/api-docs.

The Swagger UI provides a friendly interface for observing controllers, their endpoints, fields, parameters, bodies, and even sample requests.

Swagger UI Example

The API Docs might be closer to what you are looking for with the above details organized into a JSON structure. It's likely you would be able to send them a link to your API Docs so long as the app is running somewhere.

API Docs Example

You can take this many steps further and annotate specific fields of your request models with examples, annotate controller methods with possible responses, and so forth, all of which propagate to the API Docs and Swagger UI.

Hope this helps, and makes life at work a bit easier!

Collapse
 
amaralani profile image
Amir Maralani

A really good suggestion! Thanks.
Although we have some restrictions about implementing this, it would be a good alternative in other cases.

Collapse
 
verley93 profile image
Devlin Verley II

That's unfortunate! Our team also has restrictions on using Open API, but we're still able to use Swagger 2.0. Less automation but still does what we need.

Best of luck out there!