elysiajs / elysia-swagger

A plugin for Elysia to auto-generate Swagger page
MIT License
84 stars 45 forks source link

add exclude options #68

Closed steele123 closed 9 months ago

steele123 commented 10 months ago

This gets rid of options displaying in the generated swagger, useful when using for example the CORS plugin when you have several options routes. Note: by default I set it to true as I believe very few people would want CORS in their swagger.

BE-CH commented 10 months ago

@steele123 Great idea! Maybe it should be more like "excludeMethods" where you can define a list of methods to exclude?

Potentially updating the current "exclude" to have an array of objects like this;

    exclude: [{
      path: "/api/",
      methods: ["OPTIONS"]
    }],

This essentially could exclude all paths with "/api/" and the method "OPTIONS".

steele123 commented 10 months ago

ah yeah I think this overall better although most people would probably just exclude options but I like that

steele123 commented 10 months ago

hmm only downside to doing exclude like that is it'd be a breaking change, for now i'll just make it is own array as excludeMethods: ["OPTIONS"]

BE-CH commented 10 months ago

@steele123 Sounds good! Good work