# yaschema-api

> Yet another API

Latest version **5.0.5** (published 2025-09-15) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install yaschema-api
pnpm add yaschema-api
yarn add yaschema-api
bun add yaschema-api
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 5.0.5 |
| Published | 2025-09-15 |
| First published | 2023-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 168.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | bwestphal |
| Keywords | schema, typescript, client, server |

## Links

- npm: https://www.npmjs.com/package/yaschema-api
- Repository: https://github.com/TypeScript-OSS/yaschema-api
- Homepage: https://typescript-oss.github.io/yaschema-api/
- Issues: https://github.com/TypeScript-OSS/yaschema-api/issues
- npm.io page: https://npm.io/package/yaschema-api

## Dependencies (1)

- [yaschema](https://npm.io/package/yaschema.md) ^5.2.2

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 5.0.5 (latest) — 2025-09-15
- 5.0.4 — 2025-05-13
- 5.0.3 — 2025-05-09
- 5.0.0 — 2025-04-30
- 4.1.10 — 2025-04-19
- 4.1.9 — 2025-04-11
- 4.1.8 — 2025-04-05
- 4.1.7 — 2025-03-02
- 4.1.6 — 2025-02-18
- 4.1.5 — 2025-01-16
- 4.1.4 — 2025-01-06
- 4.1.3 — 2024-12-06
- 4.1.2 — 2024-12-06
- 4.1.1 — 2024-11-26
- 4.1.0 — 2024-11-15
- … 42 more at https://npm.io/package/yaschema-api/versions

## README

# yaschema-api

[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]

Yet another API.  Schema-first API modeling and validation for TypeScript, built on yaschema.

This package is almost entirely TypeScript types, except for a few configuration functions and utilities.  Yaschema-APIs have `routeType` metadata, which is helpful for directing traffic to different sets of servers.  See `setUrlBaseForRouteType` and `setDefaultUrlBase`.

Support for handling yaschema-api requests server side and for making yaschema-api requests either client or server side, is handled by other packages.

We love TypeScript and use it pretty much everywhere.  We use it for our React Native app, our React web app, as well as for our server.

We built yaschema-api as part of our type and API spec system, to be TypeScript first -- and to still conveniently support code generation and OpenAPI spec generation as needed.

Because yaschema-api leverages yaschema, you can define both runtime and compile-time validated types with a single definition.

## Basic Example

```typescript
export const POST = makeHttpApi({
  method: 'POST',
  routeType: 'rest',
  url: '/ping',
  isSafeToRetry: true,
  schemas: {
    request: {
      body: schema.object({
        echo: schema.string().allowEmptyString().optional()
      })
    },
    successResponse: {
      status: schema.number(StatusCodes.OK),
      body: schema.string()
    }
  }
});
```

## Thanks

Thanks for checking it out.  Feel free to create issues or otherwise provide feedback.

[API Docs](https://typescript-oss.github.io/yaschema-api/)

Be sure to check out our other [TypeScript OSS](https://github.com/TypeScript-OSS) projects as well.

<!-- Definitions -->

[downloads-badge]: https://img.shields.io/npm/dm/yaschema-api.svg

[downloads]: https://www.npmjs.com/package/yaschema-api

[size-badge]: https://img.shields.io/bundlephobia/minzip/yaschema-api.svg

[size]: https://bundlephobia.com/result?p=yaschema-api

---
_Source: https://npm.io/package/yaschema-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
