🚀 SvelteKit OpenAPI Generator
Auto-generate OpenAPI specs from your SvelteKit endpoints
2
API Endpoints
3
Schemas
1.0.0
Version
📚 SvelteKit OpenAPI Generator Demo
Demo API showing OpenAPI spec generation from SvelteKit endpoints
🔗 Available Endpoints
/api/todos
GET
Get all todos
Retrieve a list of all todos from in-memory reactive state
POST
Create a new todo
Add a new todo to the in-memory reactive state
/api/todos/{id}
GET
Get a todo by ID
Retrieve a specific todo by its unique identifier from in-memory reactive state
PUT
Update a todo
Update an existing todo by its ID using reactive state
DELETE
Delete a todo
Remove a todo by its ID from in-memory reactive state
📋 Schemas
Todo
id: string requiredtitle: string requiredcompleted: boolean requiredcreatedAt: string
TodoInput
title: string requiredcompleted: boolean
Error
message: string requiredcode: string
🔍 View OpenAPI Spec
📄 Raw OpenAPI Specification
(click to expand)
{
"openapi": "3.0.3",
"info": {
"title": "SvelteKit OpenAPI Generator Demo",
"version": "1.0.0",
"description": "Demo API showing OpenAPI spec generation from SvelteKit endpoints"
},
"servers": [
{
"url": "http://localhost:5173",
"description": "Development server"
}
],
"paths": {
"/api/todos": {
"get": {
"summary": "Get all todos",
"description": "Retrieve a list of all todos from in-memory reactive state",
"tags": [
"Todos"
],
"responses": {
"200": {
"description": "Successfully retrieved todos",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Todo"
}
}
}
}
}
}
},
"post": {
"summary": "Create a new todo",
"description": "Add a new todo to the in-memory reactive state",
"tags": [
"Todos"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TodoInput"
}
}
}
},
"responses": {
"201": {
"description": "Todo created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Todo"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/todos/{id}": {
"get": {
"summary": "Get a todo by ID",
"description": "Retrieve a specific todo by its unique identifier from in-memory reactive state",
"tags": [
"Todos"
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
},
"description": "The todo ID"
}
],
"responses": {
"200": {
"description": "Todo found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Todo"
}
}
}
},
"404": {
"description": "Todo not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"put": {
"summary": "Update a todo",
"description": "Update an existing todo by its ID using reactive state",
"tags": [
"Todos"
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
},
"description": "The todo ID"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TodoInput"
}
}
}
},
"responses": {
"200": {
"description": "Todo updated successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Todo"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Todo not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"delete": {
"summary": "Delete a todo",
"description": "Remove a todo by its ID from in-memory reactive state",
"tags": [
"Todos"
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
},
"description": "The todo ID"
}
],
"responses": {
"204": {
"description": "Todo deleted successfully"
},
"404": {
"description": "Todo not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Todo": {
"type": "object",
"required": [
"id",
"title",
"completed"
],
"properties": {
"id": {
"type": "string",
"description": "Unique todo identifier"
},
"title": {
"type": "string",
"description": "Todo title"
},
"completed": {
"type": "boolean",
"description": "Whether the todo is completed"
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "Creation timestamp"
}
}
},
"TodoInput": {
"type": "object",
"required": [
"title"
],
"properties": {
"title": {
"type": "string",
"description": "Todo title"
},
"completed": {
"type": "boolean",
"description": "Whether the todo is completed",
"default": false
}
}
},
"Error": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string",
"description": "Error message"
},
"code": {
"type": "string",
"description": "Error code"
}
}
}
},
"securitySchemes": {
"apiKey": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
}
}
}
}