Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Created MVP
Problem
We would like to generate a form based on a given json schema. We plan to use this to create a form website where users can input information about their project to create
code.json
for their repository.Solution
This PR is an MVP of the form generator! We use Form.io to create the form. On a high level, this does the following:
form.html
contains the form. USWDS does not work at the moment (see: Problems running HTML code locally formio/uswds#260) so we are temporarily usingbootstrap
.schemas/schema.json
as the input json schemajs/generateFormComponents.js
reads the input schema and creates Form.io components for each field. For now, text fields / string types are only supported.schemas/template-code.json
js/formDataToJson.js
reads the blank json file, converts it to an object, populates the object with form data, and downloads file to the user's machineResult
Users can generate forms using json schemas that only have fields with
type: string
. As a result, the form only contains text fields.When users fill out the form and click submit, the
code.json
is generated and downloaded onto their machine.Test Plan
python3 -m http.server 8000
form.html
code.json
. File contents should match what was submitted in the form!Will create unit tests in a separate PR after OSAB