Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI support for SEARCH HTTP verb/method #10085

Open
doronguttman opened this issue Jul 18, 2024 · 7 comments · May be fixed by #10086
Open

Add UI support for SEARCH HTTP verb/method #10085

doronguttman opened this issue Jul 18, 2024 · 7 comments · May be fixed by #10086

Comments

@doronguttman
Copy link

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 added a commit to arnica-ext/swagger-ui that referenced this issue Jul 18, 2024
@doronguttman doronguttman linked a pull request Jul 18, 2024 that will close this issue
17 tasks
@amiii123malviya
Copy link

Would Like to work on this issue..
Let me work on this ..

@doronguttman
Copy link
Author

Would Like to work on this issue.. Let me work on this ..

#10086 🤷

@JaredAAT
Copy link

JaredAAT commented Aug 8, 2024

OpenAPI doesn't seem to support the SEARCH verb as part of the spec: https://spec.openapis.org/oas/latest.html#path-item-object

@tuan-nguyen-wareflex
Copy link

OpenAPI was last published on February 15, 2021, and is outdated due to daily technical changes. I use NestJS, which supports the Search method, but Swagger UI does not support it.

@JaredAAT
Copy link

@tuan-nguyen-wareflex You can help change the OpenAPI specification, there is a discussion here: OAI/OpenAPI-Specification#1747 related to different HTTP verbs and whether they have massive support in the wild since SEARCH comes from WebDAV which is/was a Microsoft specific technology/RFC

@doronguttman
Copy link
Author

doronguttman commented Aug 28, 2024

@JaredAAT, please note that though the specs may not support is, OpenAPI actually DOES support it EXCEPT for the UI. The proposed fix is to align the UI with the generated definitions so it displays what the OpenAPI definitions already support

@JaredAAT
Copy link

@doronguttman well no... lots of confusion in that sentence there. OpenAPI does not support it, you may think that because you can add any verb to the specs that it does, but in actuality, until the issue i highlighted in my previous comment, OpenAPI does not support SEARCH or various other verbs that are not listed in the specs here: https://spec.openapis.org/oas/latest.html#path-item-object

There is no UI to OpenAPI. Swagger (which is what we're commenting on here) is a UI that can display OpenAPI documents/specs but is not the UI of OpenAPI, there are other UI's that you can get that display OpenAPI specs. If swagger were to support SEARCH as a verb, they'd be operating outside of the OpenAPI specification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants