Skip to content

Commit

Permalink
Merge pull request #709 from DEFRA/feature/466796--add-question-model
Browse files Browse the repository at this point in the history
feat(model): 466796 - Add add to component schema
  • Loading branch information
whitewaterdesign authored Feb 19, 2025
2 parents 6d3319f + d05398d commit 56ef6e4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions model/src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type ConditionalComponentType = Exclude<
*/

interface FormFieldBase {
id?: string
type: FormComponentsDef['type']
name: string
title: string
Expand All @@ -41,6 +42,7 @@ interface ListFieldBase extends FormFieldBase {
}

interface ContentFieldBase {
id?: string
type:
| ComponentType.Details
| ComponentType.Html
Expand Down
1 change: 1 addition & 0 deletions model/src/form/form-definition/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('Form definition schema', () => {
describe('Components', () => {
describe('Custom validation messages', () => {
const component: ComponentDef = {
id: 'fdeaa717-8e81-43fd-acce-2d83b6d63181',
name: 'year',
title: 'Year',
type: ComponentType.NumberField,
Expand Down
1 change: 1 addition & 0 deletions model/src/form/form-definition/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const conditionWrapperSchema = Joi.object<ConditionWrapper>().keys({

export const componentSchema = Joi.object<ComponentDef>()
.keys({
id: Joi.string().uuid().optional(),
type: Joi.string<ComponentType>().required(),
name: Joi.when('type', {
is: Joi.string().valid(
Expand Down

0 comments on commit 56ef6e4

Please sign in to comment.