Skip to content

Commit

Permalink
minor(cb2-10120): add conditional logic, remove type warnings (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivangidas authored Dec 12, 2023
1 parent 1d63563 commit f4e1346
Show file tree
Hide file tree
Showing 36 changed files with 2,136 additions and 135 deletions.
92 changes: 92 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 @@ -117,6 +117,7 @@
"items": {
"title": "Additional Examiner Notes",
"additionalProperties": false,
"type": "object",
"properties": {
"note": {
"type": [
Expand Down Expand Up @@ -992,5 +993,96 @@
"string"
]
}
},
"if": {
"properties": {
"techRecord_adrDetails_dangerousGoods": {
"const": true
}
},
"required": [
"techRecord_adrDetails_dangerousGoods"
]
},
"then": {
"required": [
"techRecord_adrDetails_vehicleDetails_type",
"techRecord_adrDetails_vehicleDetails_approvalDate",
"techRecord_adrDetails_permittedDangerousGoods",
"techRecord_adrDetails_additionalNotes_number"
],
"allOf": [
{
"if": {
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"pattern": "^Explosives \\(type \\d\\)$"
}
}
},
"required": ["techRecord_adrDetails_permittedDangerousGoods"]
},
"then": {
"required": [
"techRecord_adrDetails_compatibilityGroupJ"
]
}
},
{
"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"]
}
},
"required": ["techRecord_adrDetails_vehicleDetails_type"]
},
"then" : {
"required": [
"techRecord_adrDetails_tank_tankDetails_tankManufacturer",
"techRecord_adrDetails_tank_tankDetails_yearOfManufacture",
"techRecord_adrDetails_tank_tankDetails_tankManufacturerSerialNo",
"techRecord_adrDetails_tank_tankDetails_tankTypeAppNo",
"techRecord_adrDetails_tank_tankDetails_tankCode",
"techRecord_adrDetails_tank_tankDetails_tankStatement_substancesPermitted"
]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_listStatementApplicable": {
"const": true
}
},
"required": [
"techRecord_adrDetails_listStatementApplicable"
]
},
"then": {
"required":["techRecord_adrDetails_batteryListNumber"]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_brakeEndurance": {
"const": true
}
},
"required": [
"techRecord_adrDetails_brakeEndurance"
]
},
"then": {
"required": ["techRecord_adrDetails_weight"]
}
}
]
}
}
92 changes: 92 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 @@ -87,6 +87,7 @@
"items": {
"title": "Additional Examiner Notes",
"additionalProperties": false,
"type": "object",
"properties": {
"note": {
"type": [
Expand Down Expand Up @@ -1073,5 +1074,96 @@
"string"
]
}
},
"if": {
"properties": {
"techRecord_adrDetails_dangerousGoods": {
"const": true
}
},
"required": [
"techRecord_adrDetails_dangerousGoods"
]
},
"then": {
"required": [
"techRecord_adrDetails_vehicleDetails_type",
"techRecord_adrDetails_vehicleDetails_approvalDate",
"techRecord_adrDetails_permittedDangerousGoods",
"techRecord_adrDetails_additionalNotes_number"
],
"allOf": [
{
"if": {
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"pattern": "^Explosives \\(type \\d\\)$"
}
}
},
"required": ["techRecord_adrDetails_permittedDangerousGoods"]
},
"then": {
"required": [
"techRecord_adrDetails_compatibilityGroupJ"
]
}
},
{
"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"]
}
},
"required": ["techRecord_adrDetails_vehicleDetails_type"]
},
"then" : {
"required": [
"techRecord_adrDetails_tank_tankDetails_tankManufacturer",
"techRecord_adrDetails_tank_tankDetails_yearOfManufacture",
"techRecord_adrDetails_tank_tankDetails_tankManufacturerSerialNo",
"techRecord_adrDetails_tank_tankDetails_tankTypeAppNo",
"techRecord_adrDetails_tank_tankDetails_tankCode",
"techRecord_adrDetails_tank_tankDetails_tankStatement_substancesPermitted"
]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_listStatementApplicable": {
"const": true
}
},
"required": [
"techRecord_adrDetails_listStatementApplicable"
]
},
"then": {
"required":["techRecord_adrDetails_batteryListNumber"]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_brakeEndurance": {
"const": true
}
},
"required": [
"techRecord_adrDetails_brakeEndurance"
]
},
"then": {
"required": ["techRecord_adrDetails_weight"]
}
}
]
}
}
92 changes: 92 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 @@ -91,6 +91,7 @@
"items": {
"title": "Additional Examiner Notes",
"additionalProperties": false,
"type": "object",
"properties": {
"note": {
"type": [
Expand Down Expand Up @@ -1064,5 +1065,96 @@
"string"
]
}
},
"if": {
"properties": {
"techRecord_adrDetails_dangerousGoods": {
"const": true
}
},
"required": [
"techRecord_adrDetails_dangerousGoods"
]
},
"then": {
"required": [
"techRecord_adrDetails_vehicleDetails_type",
"techRecord_adrDetails_vehicleDetails_approvalDate",
"techRecord_adrDetails_permittedDangerousGoods",
"techRecord_adrDetails_additionalNotes_number"
],
"allOf": [
{
"if": {
"properties": {
"techRecord_adrDetails_permittedDangerousGoods": {
"type": "array",
"contains": {
"type": "string",
"pattern": "^Explosives \\(type \\d\\)$"
}
}
},
"required": ["techRecord_adrDetails_permittedDangerousGoods"]
},
"then": {
"required": [
"techRecord_adrDetails_compatibilityGroupJ"
]
}
},
{
"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"]
}
},
"required": ["techRecord_adrDetails_vehicleDetails_type"]
},
"then" : {
"required": [
"techRecord_adrDetails_tank_tankDetails_tankManufacturer",
"techRecord_adrDetails_tank_tankDetails_yearOfManufacture",
"techRecord_adrDetails_tank_tankDetails_tankManufacturerSerialNo",
"techRecord_adrDetails_tank_tankDetails_tankTypeAppNo",
"techRecord_adrDetails_tank_tankDetails_tankCode",
"techRecord_adrDetails_tank_tankDetails_tankStatement_substancesPermitted"
]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_listStatementApplicable": {
"const": true
}
},
"required": [
"techRecord_adrDetails_listStatementApplicable"
]
},
"then": {
"required":["techRecord_adrDetails_batteryListNumber"]
}
},
{
"if": {
"properties": {
"techRecord_adrDetails_brakeEndurance": {
"const": true
}
},
"required": [
"techRecord_adrDetails_brakeEndurance"
]
},
"then": {
"required": ["techRecord_adrDetails_weight"]
}
}
]
}
}
Loading

0 comments on commit f4e1346

Please sign in to comment.