sveltejs / sveltejs/kit

Automatically generate OpenAPI description from routes

Open
#12,623 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

On bigger projects having multiple API endpoints it's an advantage to have an OpenAPI description and using SwaggerUI.
Unfortunately SvelteKit doesn't proivde this out of the box. There are some libraries doing so but all of them are outdated and not having all functionalities needed.

For example i've found one, but the library doesn't provide Authorization in den OpenAPI schema and therefor also not in de SwaggerUI.

Describe the proposed solution

Generate OpenAPI description from the +server.ts files. Allow to add decorators or use defined comments to specify more details on the desired route.

For example someone can write a comment on the function with:

/**
* Description
* 
* @auth basic / bearer 
* @more :)
*/
Alternatives considered

I have looked at some libraries generating the code from the +server.ts but as described above one cannot provide additonal informations.

Importance

i cannot use SvelteKit without it

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how SvelteKit discovers and processes +server.ts route files. Define the scope for generating an OpenAPI description, including how route comments or decorators provide descriptions and authorization details. Done should mean that routes produce a usable OpenAPI schema with the requested metadata and SwaggerUI-compatible authorization information.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.