Skip to content

Commit

Permalink
Change 1010ez name length validations (#785)
Browse files Browse the repository at this point in the history
* change name length validations

* add spec for name length

* Revert "add spec for name length"

This reverts commit 9bf38ca.

* add spec for name length

* update package vers
  • Loading branch information
lihanli authored Jul 12, 2023
1 parent f0b5f8b commit 59e8a7f
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 13 deletions.
96 changes: 93 additions & 3 deletions dist/10-10EZ-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
17 changes: 8 additions & 9 deletions src/schemas/10-10EZ/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down Expand Up @@ -73,9 +78,7 @@ const schema = {
dependent: {
type: 'object',
properties: {
fullName: {
$ref: '#/definitions/fullName',
},
fullName: hcaFullName,
dependentRelation: {
enum: constants.dependentRelationships,
type: 'string',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -288,9 +289,7 @@ const schema = {
discloseFinancialInformation: {
type: 'boolean',
},
spouseFullName: {
$ref: '#/definitions/fullName',
},
spouseFullName: hcaFullName,
spouseSocialSecurityNumber: {
$ref: '#/definitions/ssn',
},
Expand Down
15 changes: 15 additions & 0 deletions test/schemas/10-10EZ/schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]'],
invalid: ['@', 'foo', 'foo.com', 'a@a', 'a@a.', '@a.com'],
Expand Down

0 comments on commit 59e8a7f

Please sign in to comment.