swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Add UI support for SEARCH HTTP verb/method

Open doronguttman opened this issue 7 months ago • 7 comments

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

doronguttman avatar Jul 18 '24 20:07 doronguttman