bvaughn / bvaughn/forms-js

Create a JSON schema mapper that transforms a JSON schema into a form-validation schema

Open
#6 11 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
11
Forks
1
PR merge metrics
No merged PRs in 30d

Description

A significant percentage of Forms JS users will likely prefer to use their pre-existing JSON schemas to validate forms. We should create a utility class that eats JSON schema and transforms it to the custom form-validation schema used by Forms JS.

For example, the following JSON schema:

``` js
{
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}
```

Should be transformed into the following Forms JS validation schema:

``` js
{
firstName: {
required: true
type: 'string'
},
lastName: {
required: true
type: 'string'
},
age: {
min: 0
type: 'integer'
}
}
```

It is likely that we will only support a subset of the JSON schema and so this issue should also result in documentation that clearly outlines what that subset is.

Contributor guide

No contributing guide indexed for this repository

Research direction

No implementation files or tests are named. Start by locating the Forms JS validation-schema entry point and reviewing the JSON Schema example against the existing schema format; define the supported subset and its mappings. Done means the mapper handles the documented subset and the supported and unsupported features are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.