# @solidgoldpig/fb-specification

> Form Builder specification library

Latest version **0.3.5** (published 2021-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @solidgoldpig/fb-specification
pnpm add @solidgoldpig/fb-specification
yarn add @solidgoldpig/fb-specification
bun add @solidgoldpig/fb-specification
```

Provides the commands `lint-all`, `validate`, `lint-data`, `format-data`, `lint-schemas`, `expand-schema`, `format-schemas`, `test-specifications`, `validate-specifications`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.5 |
| Published | 2021-04-08 |
| First published | 2021-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 281.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | github@alex.solidgoldpig.com |
| Maintainers | solidgoldpig |

## Links

- npm: https://www.npmjs.com/package/@solidgoldpig/fb-specification
- Repository: https://github.com/solidgoldpig/fb-specification
- Homepage: https://github.com/solidgoldpig/fb-specification#readme
- Issues: https://github.com/solidgoldpig/fb-specification/issues
- npm.io page: https://npm.io/package/@solidgoldpig/fb-specification

## Dependencies (15)

- [ajv](https://npm.io/package/ajv.md) ^6.10.0
- [glob](https://npm.io/package/glob.md) ^7.1.4
- [tape](https://npm.io/package/tape.md) ^4.10.2
- [yargs](https://npm.io/package/yargs.md) ^14.0.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [ajv-cli](https://npm.io/package/ajv-cli.md) ^3.0.0
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.3
- [jsonlint](https://npm.io/package/jsonlint.md) ^1.6.3
- [jsonpath](https://npm.io/package/jsonpath.md) ^1.0.2
- [npm-run-all](https://npm.io/package/npm-run-all.md) ^4.1.5
- [glob-promise](https://npm.io/package/glob-promise.md) ^3.4.0
- [test-console](https://npm.io/package/test-console.md) ^1.1.0
- [json-schema-ref-parser](https://npm.io/package/json-schema-ref-parser.md) ^7.1.0
- [json-schema-merge-allof](https://npm.io/package/json-schema-merge-allof.md) ^0.6.0
- [@solidgoldpig/fb-utils-node](https://npm.io/package/@solidgoldpig/fb-utils-node.md) ^0.1.7

## Recent versions

- 0.3.5 (latest) — 2021-04-08
- 0.3.4 — 2021-04-08
- 0.3.3 — 2021-04-07

## README

# Form Builder Specifications

JSON Schemas defining Form Builder core components

## Usage

In your components module

```
npm install @solidgoldpig/fb-specifications --save-dev
```

To lint schemas and schema test data and validate the schemas

```
test-specifications
```

## Specifications

Location

```
specifications/${name}/${name}.schema.json
```

### Definitions

Location

```
specifications/definition/${name}/${name}.definition.schema.json
```


## Specification examples

Examples for the schemas are JSON files located in a
data directory at the same level as the schema file.

Valid examples should be in

```
specifications/${name}/data/valid/
```

data.invalid/*.json

```
specifications/${name}/data/invalid/
```

## Validating schemas

NB. All of the following commands should be run from the *fb-specification* root directory:

### Validate all the schemas

Check that test data in each specification’s directory validates against the corresponding schema.

```
npm run test:schemas
```

### Validating a single schema

This command will use the data in the specified schema’s examples directory

```
node validate.js -s {schemaName}
```

### Validating other files

Validate a single file or directory

```
node validate.js {path}
```

### Testing for invalidity

Pass the -i flag (or --invalid)

```
node validate.js {path} -i
```

### Other options for the command line validator

By default, all errors encountered are displayed. To show only the first error encountered, use the --n-a flag (or --no-allErrors)

```
node validate.js {path} --help
```


## Validating/linting data

```
npm run lint
```

this runs

- `lint:schemas`
- `lint:data`

which checks that the files are valid JSON

To format the JSON files

- `format:schemas`
- `format:data`



## Generating documentation

General documentation is located in the documentation directory.

Schemas that have a corresponding .schema.md file will have that content included in the schema’a documentation.

Data test files that have a corresponding .md file will be included in a spec's documentation as examples

1. Check out fb-documentation
2. node expandAll.js
3. cd fb-documentation
4. npm run build
5. Commit and push resulting changes

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