@schem/api-endpoint
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-preview9 • Public • Published

@schem/api-endpoint

API endpoint specification based on @schem/core

install

npm install @schem/api-endpoint

or

yarn add @schem/api-endpoint

usage

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()

license

MIT

Readme

Keywords

Package Sidebar

Install

npm i @schem/api-endpoint

Weekly Downloads

0

Version

1.0.0-preview9

License

MIT

Unpacked Size

9.6 kB

Total Files

6

Last publish

Collaborators

  • uneco