Skip to content

Components: Added container component for object fields & updated code.json schema#10

Merged
natalialuzuriaga merged 5 commits intomainfrom
nat/objs
Jan 8, 2025
Merged

Components: Added container component for object fields & updated code.json schema#10
natalialuzuriaga merged 5 commits intomainfrom
nat/objs

Conversation

@natalialuzuriaga
Copy link
Copy Markdown
Contributor

@natalialuzuriaga natalialuzuriaga commented Jan 7, 2025

Problem

To collect information for object fields like date andcontact, this requires multiple components, thus we need to structure the form inputs accordingly.

Solution

This PR implements container components. This allows us to group inputs needed for the object fields. Used some recursion magic to be able to easily extract each field of the object and create a component for it.

Alongside, added repositoryURL to schema, updated options of repositoryHost and added missing description fields to some fields. File cleanup too

Result

Users can generate forms using json schemas that have fields with type: object
When users fill out the form and click submit, the code.json is generated and downloaded onto their machine.

Test Plan

  1. Start up a HTTP server using python: python3 -m http.server 8000
  2. Click on form.html
  3. Here is the form! Right click -> Inspect to open dev tools
  4. Fill out the form
  5. Click submit and downloads code.json. File contents should match what was submitted in the form!

Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
@natalialuzuriaga natalialuzuriaga changed the title Components: Added container component for object fields Components: Added container component for object fields & updated code.json schema Jan 7, 2025
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
Comment thread schemas/schema-0.0.0.json
"enum": [
"github.com/CMSgov",
"github.com/CMSgov",
"github.com/CMS-Enterprise",
Copy link
Copy Markdown
Contributor Author

@natalialuzuriaga natalialuzuriaga Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cookiecutter options are: "repository_host": ["Github.com", "GitHub ENT", "GitHub Cloud", "GitLab.com", "GitLab ENT", "GitLab ENT CCSQ"]

Need to realign, do we want links or name of github?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think links are most useful, then people can check themselves, but I'm willing to change my mind.

Copy link
Copy Markdown
Contributor

@decause-gov decause-gov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excited to see how this looks! 🚢

return components;
}

// Iterates through each json field and creates component array for Form.io
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Comment thread schemas/schema-0.0.0.json
"repositoryURL": {
"type": "string",
"format": "uri",
"description": "The URL of the public release repository for open source repositories. This field is not required for repositories that are only available as government-wide reuse or are closed (pursuant to one of the exemptions)."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also 🔥

Comment thread schemas/schema-0.0.0.json
"enum": [
"github.com/CMSgov",
"github.com/CMSgov",
"github.com/CMS-Enterprise",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think links are most useful, then people can check themselves, but I'm willing to change my mind.

@natalialuzuriaga natalialuzuriaga merged commit 69ddbf4 into main Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants