# spatialconnect-form-schema

> Validates a SpatialConnect form schema and translates to a [tcomb-json-schema](https://github.com/gcanti/tcomb-json-schema).

Latest version **3.8.1** (published 2018-05-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install spatialconnect-form-schema
pnpm add spatialconnect-form-schema
yarn add spatialconnect-form-schema
bun add spatialconnect-form-schema
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.8.1 |
| Published | 2018-05-17 |
| First published | 2016-05-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Frank Rowe |
| Maintainers | boundlessgeo |

## Links

- npm: https://www.npmjs.com/package/spatialconnect-form-schema
- Repository: https://github.com/boundlessgeo/spatialconnect-form-schema
- Homepage: https://github.com/boundlessgeo/spatialconnect-form-schema#readme
- Issues: https://github.com/boundlessgeo/spatialconnect-form-schema/issues
- npm.io page: https://npm.io/package/spatialconnect-form-schema

## Recent versions

- 3.8.1 (latest) — 2018-05-17
- 3.0.0-beta.1 (next) — 2017-07-05
- 3.8.0 — 2018-05-15
- 3.7.0 — 2018-04-13
- 3.6.0 — 2018-03-09
- 3.5.0 — 2018-02-20
- 3.4.0 — 2018-01-25
- 3.3.0 — 2018-01-22
- 3.2.0 — 2017-11-27
- 3.1.0 — 2017-11-22
- 3.0.8 — 2017-11-16
- 3.0.7 — 2017-10-27
- 3.0.6 — 2017-10-26
- 3.0.5 — 2017-09-27
- 3.0.4 — 2017-09-26
- … 34 more at https://npm.io/package/spatialconnect-form-schema/versions

## README

Validates a SpatialConnect form schema and translates to a [tcomb-json-schema](https://github.com/gcanti/tcomb-json-schema).

# Install

`npm install spatialconnect-form-schema`

# API

## translate(form: SCForm): JSONSchema

**Example**

```js
import scformschema from 'spatialconnect-form-schema';
import transform from 'tcomb-json-schema';
import t from 'tcomb-form';

let form = {
  id: 2,
  version: 0,
  form_key: "baseball_team",
  form_label: "Baseball Team",
  fields: [{
    id: 13,
    type: "string",
    field_label: "Favorite?",
    field_key: "team",
    position: 0
  }, {
    id: 14,
    type: "string",
    field_label: "Why?",
    field_key: "why",
    position: 1
  }]
};

const App = React.createClass({
  render() {
    let { schema, options } = scformschema.translate(form);
    return (
      <form>
        <t.form.Form
          type={transform(schema)}
          options={options}
          />
      </form>
    )
  }
});

```

## validate(form: SCForm): Array

Validates a form schema and returns an array of errors.

**Example**

```js
let validationErrors = scformschema.validate(form);
```

## React Native

For use in React Native applications, import the native build

```js
import scformschema from 'spatialconnect-form-schema/native';
```

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