JacobLinCool / sveltekit-api

Handles all kinds of SvelteKit data flows in one place, and automatically generate OpenAPI documentation.
https://www.npmjs.com/package/sveltekit-api
MIT License
29 stars 6 forks source link

Summary & Description for each path in OpenAPI #55

Open Romain-rd opened 6 months ago

Romain-rd commented 6 months ago

Hello,

Bravo for your idea and your implementation. I will adopt sveltekit-api.

I have a suggestion: Be able to enter a summary and a description in each path. This will allow for more explanation in Swagger or PostMan.

I made an implementation, but I'm not up to the standard with TypeScript to publish it. Sorry for the quality of the code, it's just to give an idea of possible implementation. If someone better at TypeScrip than me could finish the job, that would be great.

Good day. Archive.zip

JacobLinCool commented 6 months ago

I think your suggestion is clearer than the current solution. Currently, users can only use a modifier to add a summary and description, but I don't have time to implement it at the moment.

One idea to share: I am not sure whether using export const ..., chaining with Endpoint({ ... }).describe(...), or directly adding it in Endpoint({ ..., Description: ... }) is better. The caveat of the first solution is that IntelliSense cannot provide good help, or some dynamic type definition generation is needed.

PRs are welcomed. Don't worry about TypeScript; maybe I can help before publishing a new version.