feathersjs-ecosystem / feathers-swagger

Add documentation to your FeatherJS services and feed them to Swagger UI.
MIT License
225 stars 62 forks source link

added findQueryParameters #114

Closed xFuryMaxHD closed 6 years ago

xFuryMaxHD commented 6 years ago

Why this PR? On my work we use feathers-swagger for various services. We wanted to add a few more queries for the find method and also customize the descriptions according to our wishes. We searched for a long time and did not find any specific way to solve this problem. Therefore, we decided ourselves to add a parameter that allows us to do what we want.

What have I done? I've added a new Parameter findQueryParameter. It is now possible to add new QueryParamters or change the description of the default QueryParamters by adding this Paramter to your swaggerConfig. In my CodeExample it will look like this: app.configure( swagger({ findQueryParameters: [ { description: "This is another Description about the query parameter", in: "query", name: "$limit", type: "integer" }, .... ], tags: [ { name: "Controllers", description: "A Collection of different Controllers" } ], paths, definitions, basePath: "/someService", schemes: [ Config.environment !== "production" && Config.environment !== "staging" ? "http" : "https" ], swagger: "2.0", uiIndex: path.join(__dirname, "docs.html"), docsPath: "/apidocs" }) ); console.log(""); };

Please let me know what you think about it.