swagger-api / swagger-api/swagger-ui

Add UI support for SEARCH HTTP verb/method

Open
#10,085 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Content & configuration

Swagger/OpenAPI definition:

openapi: 3.0.0
paths:
 /v1/my-api:
   search:
     operationId: MyApiControllerV1_find
     summary: Find a record ID
     parameters: []
     requestBody:
       required: true
       content:
         application/json:
           schema:
             $ref: '#/components/schemas/RecordFindDto'
     responses:
       '200':
         description: The ID of the record
         content:
           text/plain:
             schema:
               type: string
       '403':
         description: >-
           Returned when your API key is invalid or you do not have the
           required scopes [my-api:read].
       '404':
         description: Record not found
     security:
       - bearer:
           - my-api:read
     tags:
       - 'scopes: [my-api:read]'
info:
 title: My API
 description: ''
 version: '1.0'
 contact: {}
tags: []
servers: []
components:
 securitySchemes:
   bearer:
     scheme: bearer
     type: http
     bearerFormat: myapi_{token}
 schemas:
   RecordFindDto:
     type: object
     properties:
       arg1:
         type: number
       arg2:
         type: string
       arg3:
         type: string
       arg4:
         type: string
       arg5:
         type: string
       arg6:
         type: number
       arg7:
         type: string
     required:
       - arg1
       - arg2
       - arg4
       - arg5
       - arg7

Swagger-UI configuration options:

SwaggerUIBundle({
   url: "https://localhost:3001/swagger-json",
   dom_id: "#swagger-ui",
   presets: [
     SwaggerUIBundle.presets.apis,
     SwaggerUIStandalonePreset
   ],
   plugins: [
     SwaggerUIBundle.plugins.DownloadUrl
   ],
   // requestSnippetsEnabled: true,
   layout: "StandaloneLayout"
 })
?yourQueryStringConfig
-> none
Is your feature request related to a problem?

Add UI support for SEARCH verb

Describe the solution you'd like

add the SEARCH verb to the list of supported methods. swagger itself already supports it

Describe alternatives you've considered

tried to see if there's a plugin available and did not find one

Additional context

we have an endpoint that is used to search for a record (does not mutate) and has multiple required arguments to be provided in the body of the request. GET with body is not supported by most frameworks. SARCH is becoming quite common

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 by locating the UI entry point that builds the supported HTTP-method list, using the SwaggerUIBundle configuration and OpenAPI paths example in the issue as a reproduction. Confirm the SEARCH operation is represented in the rendered UI and add or update the relevant test coverage so the method remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, 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.