API endpoint specification based on @schem/core
npm install @schem/api-endpoint
or
yarn add @schem/api-endpoint
const schema = endpointSchema({
summary: 'test endpoint',
description: 'this is test endpoint',
request: {
query: field.object({
name: field.string(),
}, {}),
body: field.object({
data: field.string(),
}, {}),
headers: field.object({
authorization: field.string(),
}, {}),
},
response: {
body: field.object({
data: field.string(),
}, {}),
headers: field.object({
'cache-control': field.string(),
}, {}),
}
})
schema.request.toJSONSchema()
schema.response.toJSONSchema()
MIT