Skip to content

Commit

Permalink
patch(cb2-10120): add conditional mandatory check in PUT schemas (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivangidas authored Dec 12, 2023
1 parent f4e1346 commit 6d56344
Show file tree
Hide file tree
Showing 19 changed files with 1,593 additions and 6 deletions.
91 changes: 91 additions & 0 deletions json-definitions/v3/tech-record/put/hgv/complete/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -942,5 +942,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"]
}
}
]
}
}
91 changes: 91 additions & 0 deletions json-definitions/v3/tech-record/put/hgv/skeleton/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1021,5 +1021,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"]
}
}
]
}
}
91 changes: 91 additions & 0 deletions json-definitions/v3/tech-record/put/hgv/testable/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1004,5 +1004,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"]
}
}
]
}
}
91 changes: 91 additions & 0 deletions json-definitions/v3/tech-record/put/lgv/complete/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,96 @@
}
]
}
},
"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 6d56344

Please sign in to comment.