Capgemini / Capgemini/gov-prototype-by-prompt

Tighten prototype validation and use the validated schema as ITemplateData

Open
#100 0 comments 0 reactions 1 assignee Claimed by @cmenon12 View on GitHub
breaking change size S
Dominant language
TypeScript
Stars
20
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### What feature do you want to see added?

Enforce stricter validation of the prototype JSON after it's been generated by AI or the user. For example:
- Ensure required questions always have a required_error_text.
- Ensure branching_choice questions are always required and have options_branching.
- Ensure questions with choices always have options.

Use this validated schema as ITemplateData in the code, so there's less work needed to handle it as if it hasn't been validated. For example:
- If a question is required, assert that required_error_text will always be present.
- Assert that options or options_branching will only be present for their respective question types, and will always be present for them.
- If a question has a detailed explanation or can't have hint text, assert that it won't have hint text.
- Assert that answer_type is a list of the acceptable types, not just a string.

### Why do you want this feature? Does it solve a problem?

Currently a lot of fields are marked as optional, so more work is needed to handle them potentially not being present. Tighter validation should ensure that they either are definitely present or are not, which means less certainty and more unnecessary handling.

### How should the feature be implemented?

This will likely be a breaking change as all previous prototypes will need to be validated and potentially updated.

### Additional context (if applicable)

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.