PATCH operation not working through Swagger UI
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PATCH operation not working through Swagger UI
When I perform a PATCH operation through Swagger UI it gives the following error in the UI(with CORS enabled):
TypeError: Failed to fetch
Following is the curl command :
curl -X PATCH "http://##HOSTNAME##:##PORT##/metamodel/v1/services/DUMMY/D_Dummy_1/approve?version=1" -H "accept: application/json" -H "workspace_id: ##INFODOM##" -H "x-tenant-id: dmt" -H "user: hs" -H "locale: en_US"
The logs show only the header parameter names, their corressponding values are not being received. Also the content-type recieved is :
Content-Type: text/plain (which should ideally be 'application/json')
The same operation works through Postman or even when the CURL command is executed. Also, other operations such as GET, POST are working fine through Swagger UI.
- Labels:
-
Swagger Editor
-
Swagger UI
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there did you resolve this issue? I am new to swagger and breaking my head to solve this issue.
I came across this same one and not sure if we can resolve this is not. Few things I observed,
1. Though the CORS is enabled by default, there should be someway to enable them in swagger as well if you want some kind of authorisation to work. (https://swagger.io/docs/open-source-tools/swagger-ui/usage/cors/)
2. There is some method to add `options` in the swagger code in a way you can do step 1. Please refer to the link for a rough idea, however, it is not working. I know I am missing something here but I tried everything I can to figure it out but failed. (https://www.reddit.com/r/aws/comments/89i459/api_gateway_cors_definition_with_swagger/)
3. I am not familiar with that yaml anchor part explained in the previous link.
If you figured out what went wrong? Can you please share how you did that? If not, check the half way things i tried to solve, and check if you can guess something 😉
