diff --git a/dist/10-10EZ-schema.json b/dist/10-10EZ-schema.json index 853e2dcf1..571dc6ec1 100644 --- a/dist/10-10EZ-schema.json +++ b/dist/10-10EZ-schema.json @@ -213,7 +213,37 @@ "type": "object", "properties": { "fullName": { - "$ref": "#/definitions/fullName" + "type": "object", + "properties": { + "first": { + "type": "string", + "minLength": 1, + "maxLength": 25 + }, + "middle": { + "type": "string", + "maxLength": 30 + }, + "last": { + "type": "string", + "minLength": 1, + "maxLength": 35 + }, + "suffix": { + "type": "string", + "enum": [ + "Jr.", + "Sr.", + "II", + "III", + "IV" + ] + } + }, + "required": [ + "first", + "last" + ] }, "dependentRelation": { "enum": [ @@ -384,7 +414,37 @@ } }, "veteranFullName": { - "$ref": "#/definitions/fullName" + "type": "object", + "properties": { + "first": { + "type": "string", + "minLength": 1, + "maxLength": 25 + }, + "middle": { + "type": "string", + "maxLength": 30 + }, + "last": { + "type": "string", + "minLength": 1, + "maxLength": 35 + }, + "suffix": { + "type": "string", + "enum": [ + "Jr.", + "Sr.", + "II", + "III", + "IV" + ] + } + }, + "required": [ + "first", + "last" + ] }, "mothersMaidenName": { "type": "string" @@ -1586,7 +1646,37 @@ "type": "boolean" }, "spouseFullName": { - "$ref": "#/definitions/fullName" + "type": "object", + "properties": { + "first": { + "type": "string", + "minLength": 1, + "maxLength": 25 + }, + "middle": { + "type": "string", + "maxLength": 30 + }, + "last": { + "type": "string", + "minLength": 1, + "maxLength": 35 + }, + "suffix": { + "type": "string", + "enum": [ + "Jr.", + "Sr.", + "II", + "III", + "IV" + ] + } + }, + "required": [ + "first", + "last" + ] }, "spouseSocialSecurityNumber": { "$ref": "#/definitions/ssn" diff --git a/package.json b/package.json index db26f5abf..7147f3748 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vets-json-schema", - "version": "20.26.13", + "version": "20.27.0", "repository": { "type": "git", "url": "git+https://github.com/department-of-veterans-affairs/vets-json-schema.git" diff --git a/src/schemas/10-10EZ/schema.js b/src/schemas/10-10EZ/schema.js index 76197715e..1cb947405 100644 --- a/src/schemas/10-10EZ/schema.js +++ b/src/schemas/10-10EZ/schema.js @@ -35,6 +35,11 @@ countryStateProperties.push({ }, }); +let hcaFullName = _.cloneDeep(definitions.fullName); +hcaFullName.properties.first.maxLength = 25; +hcaFullName.properties.last.maxLength = 35; +hcaFullName.properties.middle.maxLength = 30; + const schema = { $schema: 'http://json-schema.org/draft-04/schema#', title: 'APPLICATION FOR HEALTH BENEFITS (10-10EZ)', @@ -73,9 +78,7 @@ const schema = { dependent: { type: 'object', properties: { - fullName: { - $ref: '#/definitions/fullName', - }, + fullName: hcaFullName, dependentRelation: { enum: constants.dependentRelationships, type: 'string', @@ -194,9 +197,7 @@ const schema = { attachments.items.properties.dd214 = { type: 'boolean' }; return attachments; })(), - veteranFullName: { - $ref: '#/definitions/fullName', - }, + veteranFullName: hcaFullName, // Revisit how to validate that this is either empty or a string between 2 and 35 characters mothersMaidenName: { type: 'string', @@ -288,9 +289,7 @@ const schema = { discloseFinancialInformation: { type: 'boolean', }, - spouseFullName: { - $ref: '#/definitions/fullName', - }, + spouseFullName: hcaFullName, spouseSocialSecurityNumber: { $ref: '#/definitions/ssn', }, diff --git a/test/schemas/10-10EZ/schema.spec.js b/test/schemas/10-10EZ/schema.spec.js index ce6b39d26..f376d2523 100644 --- a/test/schemas/10-10EZ/schema.spec.js +++ b/test/schemas/10-10EZ/schema.spec.js @@ -140,6 +140,21 @@ describe('healthcare-application json schema', () => { invalid: [1], }); + schemaTestHelper.testValidAndInvalid('veteranFullName', { + valid: [ + { + first: 'a0ad6a23fa748a2768fcf6041', + last: 'dfdf' + } + ], + invalid: [ + { + first: 'a0ad6a23fa748a2768fcf6041d', + last: 'dfdf' + } + ] + }); + schemaTestHelper.testValidAndInvalid('email', { valid: ['a@a.com', 'a@a.net', 'a+2@a.com', 'Foo@foo.com', 'foo.bar@foo.org'], invalid: ['@', 'foo', 'foo.com', 'a@a', 'a@a.', '@a.com'],