swaggo / swag

Automatically generate RESTful API documentation with Swagger 2.0 for Go.
MIT License
10.19k stars 1.16k forks source link

Support `application/json-patch+json` MIME type #1487

Open bcordobaq opened 1 year ago

bcordobaq commented 1 year ago

Hi, I noticed that the application/json-patch+json MIME type is not supported, which is needed for PATCH operations. This type is defined in RFC 6902. The problem is that the accepted MIME types are a fixed list, so if the type is not mapped there, it breaks during swag generation:

ParseComment error in file XXX.go :json-patch+json accept type can't be accepted

To solve this, a possible solution might be adding the type mapping as json-patch into the MIME list.

Other alternatives might be supporting a full Content-Type declaration, with no mapping, considering the user value as the final accept/produce values.

Thanks!

icanc0 commented 10 months ago

I second this, it seems like application/pdf is also not accepted.