teunmooij / payload-tools

Collection of payload plugins and tools: payload-openapi, payload-swagger, create-payload-api-docs, payload-rbac
https://github.com/teunmooij/payload-tools/#readme
MIT License
94 stars 12 forks source link

Loosing existing endpoint when merging custom method #62

Closed teunmooij closed 1 year ago

teunmooij commented 1 year ago
          Thank you, @teunmooij , for the excellent plugin for Payload CMS. I encountered an issue related to the custom endpoint. I want to add an API with `type='options'` to my custom endpoint. However, when I do so, the Swagger document removes all the existing endpoints with types `'get,' 'post,' and 'delete'` 

My concern is whether there is a solution to merge the default types with the custom type in our Swagger document. Screenshot 2023-05-22 at 13 20 36

Originally posted by @thnhat51202574 in https://github.com/teunmooij/payload-tools/issues/25#issuecomment-1556606045

teunmooij commented 1 year ago

@thnhat51202574 thanks for reporting this potential bug. Can you maybe explain how you added the custom endpoint?

I tried to reproduce, but had no issue adding the endpoint image

thnhat51202574 commented 1 year ago

Thank you for responding, @teunmooij . I added the custom endpoint to the root config object.. Screenshot 2023-05-23 at 18 29 12 But the result is different from yours, Did i have any wrong configurations ? Screenshot 2023-05-23 at 18 30 32

teunmooij commented 1 year ago

Your configuration is correct. I was able to reproduce. Thanks for the extra info. I'll write a fix.

teunmooij commented 1 year ago

I've released version 1.1.3, which fixes this issue.

The issue on which you originally posted this issue intends to improve custom endpoint documentation in general (eg make it possible to specify a return type). I'll pick that one up soon.

thnhat51202574 commented 1 year ago

Thanks a lot @teunmooij