swagger-api / swagger-api/swagger-ui

Rendering response class of an HTTP method as a link in the HTML visualization

Open
#5,059 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: rendering P2 type: enhancement
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Content & configuration

Swagger/OpenAPI definition:

# your YAML here
swagger: '2.0'
info:
 description: TestCase
 version: 1.0.0
 title: Swagger Rest API Test Case
basePath: /api
tags:
 - name: testcase
paths:
 /testcase/create entity:
   get:
     tags:
       - testcase
     summary: CreateEntity
     description: verbose description
     operationId: createEntity
     produces:
       - application/json
     parameters:
       - name: guid
         in: query
         description: guid of request
         required: true
         type: string
       - name: contextId
         in: query
         description: context id of request
         required: false
         type: string
     responses:
       '200':
         description: successful operation
         schema:
           $ref: '#/definitions/MyResponseClass'
definitions:
 MyResponseClass:
   type: object
   properties:
     getrLogId:
       type: string
     webformContactId:
       type: integer
       format: int64
     webformSubmissionId:
       type: integer
       format: int64
     status:
       type: string
       enum:
         - SUCCESS
         - FAILURE
         - WARNING

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
   <script src="./swagger-ui-bundle.js"> </script>
   <script src="./swagger-ui-standalone-preset.js"> </script>
   <script><script>
   window.onload = function() {
     // Begin Swagger UI call region
     const ui = SwaggerUIBundle({
       url: getEndpointUrl(),
       dom_id: '#swagger-ui',
       deepLinking: true,
       presets: [
         SwaggerUIBundle.presets.apis,
         SwaggerUIStandalonePreset
       ],
       plugins: [
         SwaggerUIBundle.plugins.DownloadUrl
       ],
       layout: "StandaloneLayout"
     })
     // End Swagger UI call region

     window.ui = ui
   }
</script>
})
?yourQueryStringConfig

None

Is your feature request related to a problem?

I would like the response class of the Http method to be provided as a link in the Http method as an easy reference. For example currently the Responses header looks like

current

I would like it to look like

desired

Describe the solution you'd like

desired

Describe alternatives you've considered

None

Additional context

The addition of a link provides clear indication of the response structure and easy navigation to the response structure

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the SwaggerUIBundle response rendering for the provided Swagger 2.0 definition and trace how the response schema is displayed in the HTML visualization. Make the referenced MyResponseClass navigable from the HTTP method response, then verify the link and destination using the supplied example and desired screenshot.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.