JSON Schema fixed, commented and updated with 'qualite' conditions on 'denomination' and 'raison_sociale'
This commit is contained in:
parent
6b4106ae25
commit
6e709a0448
|
@ -108,15 +108,16 @@ JSON_SCHEMA_CREATE_DOSSIER_IN = {
|
||||||
"items": { "$ref": "#/definitions/refs-cadastrales" }
|
"items": { "$ref": "#/definitions/refs-cadastrales" }
|
||||||
},
|
},
|
||||||
"autres_parcelles": {
|
"autres_parcelles": {
|
||||||
#"enum": ["Oui","Non"]
|
"type": "boolean"
|
||||||
"type": "boolean"
|
|
||||||
},
|
},
|
||||||
"references_cadastrales": {
|
"references_cadastrales": {
|
||||||
"description": "A list of 'cadastrales' references",
|
"description": "A list of 'cadastrales' references",
|
||||||
# conditionaly required and typed below
|
# conditionaly required and typed below
|
||||||
},
|
},
|
||||||
"proprietaire" : { "enum": ["Oui","Non"] },
|
"proprietaire" : { "enum": ["Oui","Non"] },
|
||||||
"proprietaire_qualite" : { "type": "string" },
|
"qualite" : { "type": "string" },
|
||||||
|
"denomination" : { }, # conditionaly required and typed below
|
||||||
|
"raison_sociale" : { }, # conditionaly required and typed below
|
||||||
"nom" : { "type": "string" },
|
"nom" : { "type": "string" },
|
||||||
"prenom" : { "type": "string" },
|
"prenom" : { "type": "string" },
|
||||||
"numero_voie" : { "type": "string" },
|
"numero_voie" : { "type": "string" },
|
||||||
|
@ -142,33 +143,51 @@ JSON_SCHEMA_CREATE_DOSSIER_IN = {
|
||||||
"terrain_localite",
|
"terrain_localite",
|
||||||
"reference_cadastrale",
|
"reference_cadastrale",
|
||||||
"proprietaire",
|
"proprietaire",
|
||||||
"proprietaire_qualite"
|
"qualite",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
"numero_voie",
|
||||||
|
"nom_voie",
|
||||||
|
"code_postal",
|
||||||
|
"localite"
|
||||||
],
|
],
|
||||||
|
|
||||||
# conditional requirements
|
# conditional requirements
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
|
# qualite
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
|
|
||||||
|
# if qualite == "Une personne physique"
|
||||||
|
# "denomination" and "raison_sociale" are not required
|
||||||
|
# and must be null
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"autres_parcelles": { "const": False },
|
"qualite": { "const": "Une personne physique" },
|
||||||
"references_cadastrales": { "type": "null" }
|
"denomination" : { "type": "null" },
|
||||||
|
"raison_sociale": { "type": "null" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
# if qualite == "Une personne morale"
|
||||||
|
# "denomination" and "raison_sociale" are required
|
||||||
|
# and must be string
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"autres_parcelles": { "const": True },
|
"qualite": { "const": "Une personne morale" },
|
||||||
"references_cadastrales": {
|
"denomination" : { "type": "string" },
|
||||||
"type": "array",
|
"raison_sociale": { "type": "string" }
|
||||||
"items": { "$ref": "#/definitions/refs-cadastrales" }
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"required": ["autres_parcelles", "references_cadastrales"]
|
"required": ["denomination","raison_sociale"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
# proprietaire
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
|
|
||||||
|
# if proprietaire == "Oui"
|
||||||
|
# all the mandataire fields are not required
|
||||||
|
# and must be null
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"proprietaire": { "const": "Oui" },
|
"proprietaire": { "const": "Oui" },
|
||||||
|
@ -179,16 +198,13 @@ JSON_SCHEMA_CREATE_DOSSIER_IN = {
|
||||||
"mandataire_code_postal": { "type": "null" },
|
"mandataire_code_postal": { "type": "null" },
|
||||||
"mandataire_localite" : { "type": "null" },
|
"mandataire_localite" : { "type": "null" },
|
||||||
"mandataire_lieu_dit" : { "type": "null" }
|
"mandataire_lieu_dit" : { "type": "null" }
|
||||||
},
|
}
|
||||||
"required": [
|
|
||||||
"nom",
|
|
||||||
"prenom",
|
|
||||||
"numero_voie",
|
|
||||||
"nom_voie",
|
|
||||||
"code_postal",
|
|
||||||
"localite"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# if proprietaire == "Non"
|
||||||
|
# all the mandataire fields are required (except the lieu_dit)
|
||||||
|
# and must be string
|
||||||
|
# and conditions are checked against mandataire_qualite
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"proprietaire": { "const": "Non" },
|
"proprietaire": { "const": "Non" },
|
||||||
|
@ -198,6 +214,7 @@ JSON_SCHEMA_CREATE_DOSSIER_IN = {
|
||||||
"mandataire_nom_voie" : { "type": "string" },
|
"mandataire_nom_voie" : { "type": "string" },
|
||||||
"mandataire_code_postal": { "type": "string" },
|
"mandataire_code_postal": { "type": "string" },
|
||||||
"mandataire_localite" : { "type": "string" },
|
"mandataire_localite" : { "type": "string" },
|
||||||
|
"mandataire_qualite" : { "type": "string" },
|
||||||
"mandataire_lieu_dit" : { "type": ["string","null"] }
|
"mandataire_lieu_dit" : { "type": ["string","null"] }
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
@ -206,10 +223,65 @@ JSON_SCHEMA_CREATE_DOSSIER_IN = {
|
||||||
"mandataire_numero_voie",
|
"mandataire_numero_voie",
|
||||||
"mandataire_nom_voie",
|
"mandataire_nom_voie",
|
||||||
"mandataire_code_postal",
|
"mandataire_code_postal",
|
||||||
"mandataire_localite"
|
"mandataire_localite",
|
||||||
|
"mandataire_qualite"
|
||||||
|
],
|
||||||
|
|
||||||
|
# mandataire_qualite
|
||||||
|
"anyOf": [
|
||||||
|
|
||||||
|
# if mandataire_qualite == "Une personne physique"
|
||||||
|
# "mandataire_denomination" and "mandataire_raison_sociale" are not required
|
||||||
|
# and must be null
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"mandataire_qualite": { "const": "Une personne physique" },
|
||||||
|
"mandataire_denomination" : { "type": "null" },
|
||||||
|
"mandataire_raison_sociale": { "type": "null" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
# if mandataire_qualite == "Une personne morale"
|
||||||
|
# "mandataire_denomination" and "mandataire_raison_sociale" are required
|
||||||
|
# and must be string
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"mandataire_qualite": { "const": "Une personne morale" },
|
||||||
|
"mandataire_denomination" : { "type": "string" },
|
||||||
|
"mandataire_raison_sociale": { "type": "string" }
|
||||||
|
},
|
||||||
|
"required": ["mandataire_denomination","mandataire_raison_sociale"]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
# autres_parcelles
|
||||||
|
"anyOf": [
|
||||||
|
|
||||||
|
# if autres_parcelles == False
|
||||||
|
# "references_cadastrales" is not required
|
||||||
|
# and must be null
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"autres_parcelles": { "const": False },
|
||||||
|
"references_cadastrales": { "type": "null" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
# if autres_parcelles == True
|
||||||
|
# "references_cadastrales" is required
|
||||||
|
# and must be of type "array" of "refs-cadastrales"
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"autres_parcelles": { "const": True },
|
||||||
|
"references_cadastrales": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#/definitions/refs-cadastrales" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["autres_parcelles", "references_cadastrales"]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue