# @alexcons/admin-api-schema

> ## Install

Latest version **1.2.10** (published 2026-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @alexcons/admin-api-schema
pnpm add @alexcons/admin-api-schema
yarn add @alexcons/admin-api-schema
bun add @alexcons/admin-api-schema
```

## Health

**Score 45/100 (D)** — status: active.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.2.10 |
| Published | 2026-03-10 |
| First published | 2021-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 126.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ghost Foundation |
| Maintainers | alecons |

## Links

- npm: https://www.npmjs.com/package/@alexcons/admin-api-schema
- npm.io page: https://npm.io/package/@alexcons/admin-api-schema

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.3
- [ghost-ignition](https://npm.io/package/ghost-ignition.md) 4.2.4
- [@tryghost/errors](https://npm.io/package/@tryghost/errors.md) 0.2.5

## Recent versions

- 1.2.10 (latest) — 2026-03-10
- 1.2.9 — 2026-03-06
- 1.2.8 — 2025-10-29
- 1.2.7 — 2025-06-10
- 1.2.6 — 2025-04-22
- 1.2.5 — 2025-03-07
- 1.2.4 — 2023-09-13
- 1.2.3 — 2022-06-22
- 1.2.2 — 2022-06-22
- 1.2.1 — 2022-06-22
- 1.2.0 — 2022-06-11
- 1.1.11 — 2022-04-01
- 1.1.10 — 2021-12-17
- 1.1.9 — 2021-11-19
- 1.1.8 — 2021-10-12
- … 10 more at https://npm.io/package/@alexcons/admin-api-schema/versions

## README

# Admin Api Schema

## Install

`npm install @alecons-tryghost/admin-api-schema --save`

or

`yarn add @alecons-tryghost/admin-api-schema`


## Usage
```js
const jsonSchema = require('@alecons-tryghost/admin-api-schema');

// check available schemas
jsonSchema.list()
/*
> [
  'images-upload', 'labels-add',
  'labels-edit',   'members-add',
  'members-edit',  'members-upload',
  'pages-add',     'pages-edit',
  'posts-add',     'posts-edit',
  'tags-add',      'tags-edit',
  'webhooks-add',  'webhooks-edit'
]
*/

// get schema definition
jsonSchema.get('tags-edit');
/*
> {
  '$schema': 'http://json-schema.org/draft-07/schema#',
  '$id': 'tags.edit.canary',
  title: 'tags.edit',
  description: 'Schema for tags.edit',
  type: 'object',
  additionalProperties: false,
  properties: {
    tags: { type: 'array', minItems: 1, maxItems: 1, items: [Object] }
  },
  required: [ 'tags' ]
}
*/

// validate data
const data = {
    posts: [{
        title: 'valid'
    }]
};

try {
    await apiSchema.validate({data, schema: 'posts-add'});
} catch (err) {
    console.log('validateion error:', err);
}
```

When used from Ghost core in validation layer:
```js
const jsonSchema = require('@alecons-tryghost/admin-api-schema');
const validate = async (apiConfig, frame) => await jsonSchema.validate({
    data: frame.data,
    schema: `${apiConfig.docName}-${apiConfig.method}`,
    version: 'canary'
});
```

## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License

Copyright (c) 2019 Ghost Foundation - Released under the [MIT license](LICENSE).

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