Skip to content

Commit

Permalink
feat(cb2-13786): add in new ADR field with validation
Browse files Browse the repository at this point in the history
  • Loading branch information
naathanbrown committed Oct 14, 2024
1 parent 89e4a86 commit e635bea
Show file tree
Hide file tree
Showing 53 changed files with 1,705 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "ADR Body Declaration Types",
"type": "string",
"tsEnumNames": [
"PRE_1_JULY_2005",
"ON_OR_AFTER_1_JULY_2005",
"UNKNOWN"
],
"enum": [
"Pre 1st July 2005",
"On or after 1st July 2005",
"Unknown"
]
}
37 changes: 37 additions & 0 deletions json-definitions/v3/tech-record/get/hgv/complete/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@
"null"
]
},
"techRecord_adrDetails_bodyDeclaration_type": {
"anyOf": [
{
"type": "null"
},
{
"$ref": "../../../enums/adrBodyDeclarationType.enum.json"
}
]
},
"techRecord_adrDetails_vehicleDetails_usedOnInternationalJourneys": {
"anyOf": [
{
Expand Down Expand Up @@ -1074,6 +1084,33 @@
]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"not": {
"enum": [
"Explosives (type 3)"
]
}
}
}
},
"required": [
"techRecord_adrDetails_permittedDangerousGoods"
]
},
"then": {
"not": {
"required": [
"techRecord_adrDetails_bodyDeclaration_type"
]
}
}
},
{
"if": {
"properties": {
Expand Down
37 changes: 37 additions & 0 deletions json-definitions/v3/tech-record/get/hgv/skeleton/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@
"null"
]
},
"techRecord_adrDetails_bodyDeclaration_type": {
"anyOf": [
{
"type": "null"
},
{
"$ref": "../../../enums/adrBodyDeclarationType.enum.json"
}
]
},
"techRecord_adrDetails_vehicleDetails_usedOnInternationalJourneys": {
"anyOf": [
{
Expand Down Expand Up @@ -1155,6 +1165,33 @@
]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"not": {
"enum": [
"Explosives (type 3)"
]
}
}
}
},
"required": [
"techRecord_adrDetails_permittedDangerousGoods"
]
},
"then": {
"not": {
"required": [
"techRecord_adrDetails_bodyDeclaration_type"
]
}
}
},
{
"if": {
"properties": {
Expand Down
37 changes: 37 additions & 0 deletions json-definitions/v3/tech-record/get/hgv/testable/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@
"null"
]
},
"techRecord_adrDetails_bodyDeclaration_type": {
"anyOf": [
{
"type": "null"
},
{
"$ref": "../../../enums/adrBodyDeclarationType.enum.json"
}
]
},
"techRecord_adrDetails_vehicleDetails_usedOnInternationalJourneys": {
"anyOf": [
{
Expand Down Expand Up @@ -1146,6 +1156,33 @@
]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"not": {
"enum": [
"Explosives (type 3)"
]
}
}
}
},
"required": [
"techRecord_adrDetails_permittedDangerousGoods"
]
},
"then": {
"not": {
"required": [
"techRecord_adrDetails_bodyDeclaration_type"
]
}
}
},
{
"if": {
"properties": {
Expand Down
86 changes: 69 additions & 17 deletions json-definitions/v3/tech-record/get/lgv/complete/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
"maxLength": 255
},
"techRecord_adrDetails_documentId": {
"type": "string"
},
"type": "string"
},
"techRecord_adrDetails_dangerousGoods": {
"type": [
"boolean",
Expand All @@ -87,6 +87,16 @@
"null"
]
},
"techRecord_adrDetails_bodyDeclaration_type": {
"anyOf": [
{
"type": "null"
},
{
"$ref": "../../../enums/adrBodyDeclarationType.enum.json"
}
]
},
"techRecord_adrDetails_vehicleDetails_usedOnInternationalJourneys": {
"anyOf": [
{
Expand Down Expand Up @@ -472,7 +482,7 @@
"createdByName": {
"type": "string"
},
"certificateType":{
"certificateType": {
"$ref": "../../../enums/adrCertificateTypes.enum.json"
},
"generatedTimestamp": {
Expand Down Expand Up @@ -638,13 +648,15 @@
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"pattern": "^Explosives \\(type \\d\\)$"
}
"contains": {
"type": "string",
"pattern": "^Explosives \\(type \\d\\)$"
}
}
},
"required": ["techRecord_adrDetails_permittedDangerousGoods"]
"required": [
"techRecord_adrDetails_permittedDangerousGoods"
]
},
"then": {
"required": [
Expand All @@ -653,17 +665,53 @@
}
},
{
"if" : {
"if": {
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"not": {
"enum": [
"Explosives (type 3)"
]
}
}
}
},
"required": [
"techRecord_adrDetails_permittedDangerousGoods"
]
},
"then": {
"not": {
"required": [
"techRecord_adrDetails_bodyDeclaration_type"
]
}
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_vehicleDetails_type": {
"enum": ["Rigid tank","Rigid battery","Full drawbar tank",
"Full drawbar battery", "Centre axle tank" ,"Centre axle battery",
"Semi trailer tank","Semi trailer battery"]
"enum": [
"Rigid tank",
"Rigid battery",
"Full drawbar tank",
"Full drawbar battery",
"Centre axle tank",
"Centre axle battery",
"Semi trailer tank",
"Semi trailer battery"
]
}
},
"required": ["techRecord_adrDetails_vehicleDetails_type"]
"required": [
"techRecord_adrDetails_vehicleDetails_type"
]
},
"then" : {
"then": {
"required": [
"techRecord_adrDetails_tank_tankDetails_tankManufacturer",
"techRecord_adrDetails_tank_tankDetails_yearOfManufacture",
Expand All @@ -686,7 +734,9 @@
]
},
"then": {
"required":["techRecord_adrDetails_batteryListNumber"]
"required": [
"techRecord_adrDetails_batteryListNumber"
]
}
},
{
Expand All @@ -701,9 +751,11 @@
]
},
"then": {
"required": ["techRecord_adrDetails_weight"]
"required": [
"techRecord_adrDetails_weight"
]
}
}
]
}
}
}
Loading

0 comments on commit e635bea

Please sign in to comment.