ts-openapi-contract-first-boilerplate
Version:
A boilerplate for building contract-first APIs in TypeScript with OpenAPI. Includes OpenAPI definition, compliant server setup, and npm package generation for seamless API development.
95 lines • 2.34 kB
JSON
{
"openapi": "3.1.0",
"info": {
"title": "Crosscutting API",
"summary": "A boilerplate for building contract-first APIs in TypeScript with OpenAPI. Includes OpenAPI definition, compliant server setup, and npm package generation for seamless API development.",
"version": "0.0.0"
},
"servers": [
{
"url": "https://localhost:8080",
"description": "Production server"
}
],
"tags": [
{
"name": "Crosscutting",
"description": "Operation related to a crosscutting actions"
}
],
"paths": {
"/health-check": {
"get": {
"tags": [
"Crosscutting"
],
"summary": "Health check endpoint",
"responses": {
"200": {
"description": "Correct response indicating that the server is alive",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"data": 1523,
"timestamp": 1707947871722
},
"allOf": [
{
"$ref": "#/components/schemas/response.model"
},
{
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "number"
}
}
}
]
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"id-request.model": {
"type": "object",
"required": [
"uuid"
],
"properties": {
"uuid": {
"type": "string",
"example": "f0a6f400-be55-42ae-9545-1bcba9b69b99"
}
}
},
"response.model": {
"type": "object",
"required": [
"code",
"timestamp"
],
"properties": {
"code": {
"type": "number",
"example": "200"
},
"timestamp": {
"type": "number",
"example": "1707947871721"
}
}
}
}
}
}