0001-jsonschema-use-draft-4-and-avoid-schemas-references-.patch
passerelle/apps/astregs/models.py | ||
---|---|---|
28 | 28 |
from passerelle.utils.jsonresponse import APIError |
29 | 29 | |
30 | 30 |
ASSOCIATION_SCHEMA = { |
31 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
31 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
32 | 32 |
"title": "AstreGS assocation", |
33 | 33 |
"description": "", |
34 | 34 |
"type": "object", |
35 |
"required": [ |
|
36 |
"Financier", "CodeFamille", "CatTiers", "NomEnregistrement", "StatutTiers", |
|
37 |
"Type", "NumeroSiret", "NumeroSiretFin", "AdresseTitre", "AdresseIsAdresseDeCommande", |
|
38 |
"AdresseIsAdresseDeFacturation" |
|
39 |
], |
|
35 | 40 |
"properties": { |
36 | 41 |
"Financier": { |
37 | 42 |
"description": "financial association", |
38 | 43 |
"type": "string", |
39 |
"required": True, |
|
40 | 44 |
"enum": ["true", "false"] |
41 | 45 |
}, |
42 | 46 |
"CodeFamille": { |
43 | 47 |
"description": "association family code", |
44 | 48 |
"type": "string", |
45 |
"required": True |
|
46 | 49 |
}, |
47 | 50 |
"CatTiers": { |
48 | 51 |
"description": "association category", |
49 | 52 |
"type": "string", |
50 |
"required": True |
|
51 | 53 |
}, |
52 | 54 |
"NomEnregistrement": { |
53 | 55 |
"description": "association name", |
54 | 56 |
"type": "string", |
55 |
"required": True |
|
56 | 57 |
}, |
57 | 58 |
"StatutTiers": { |
58 | 59 |
"description": "association status", |
59 | 60 |
"type": "string", |
60 |
"required": True, |
|
61 | 61 |
"enum": ["PROPOSE", "VALIDE", "REFUSE", "BLOQUE", "A COMPLETER"] |
62 | 62 |
}, |
63 | 63 |
"Type": { |
64 | 64 |
"description": "association type", |
65 | 65 |
"type": "string", |
66 |
"required": True, |
|
67 | 66 |
"enum": ["D", "F", "*"] |
68 | 67 |
}, |
69 | 68 |
"NumeroSiret": { |
70 | 69 |
"description": "SIREN number", |
71 | 70 |
"type": "string", |
72 |
"required": True |
|
73 | 71 |
}, |
74 | 72 |
"NumeroSiretFin": { |
75 | 73 |
"description": "NIC number", |
76 | 74 |
"type": "string", |
77 |
"required": True |
|
78 | 75 |
}, |
79 | 76 |
"AdresseTitre": { |
80 | 77 |
"type": "string", |
81 |
"required": True |
|
82 | 78 |
}, |
83 | 79 |
"AdresseIsAdresseDeCommande": { |
84 | 80 |
"type": "string", |
85 |
"required": True, |
|
86 | 81 |
"enum": ["true", "false"] |
87 | 82 |
}, |
88 | 83 |
"AdresseIsAdresseDeFacturation": { |
89 | 84 |
"type": "string", |
90 |
"required": True, |
|
91 | 85 |
"enum": ["true", "false"] |
92 | 86 |
} |
93 | 87 |
} |
94 | 88 |
} |
95 | 89 | |
96 | 90 |
CONTACT_SCHEMA = { |
97 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
91 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
98 | 92 |
"title": "AstreGS contact", |
99 | 93 |
"description": "", |
100 | 94 |
"type": "object", |
95 |
"required": [ |
|
96 |
"CodeContact", "CodeTitreCivilite", "Nom", "AdresseDestinataire", "CodePostal", "Ville", |
|
97 |
"EncodeKeyStatut" |
|
98 |
], |
|
101 | 99 |
"properties": { |
102 | 100 |
"CodeContact": { |
103 | 101 |
"type": "string", |
104 |
"required": True |
|
105 | 102 |
}, |
106 | 103 |
"CodeTitreCivilite": { |
107 | 104 |
"type": "string", |
108 |
"required": True |
|
109 | 105 |
}, |
110 | 106 |
"Nom": { |
111 | 107 |
"type": "string", |
112 |
"required": True |
|
113 | 108 |
}, |
114 | 109 |
"AdresseDestinataire": { |
115 | 110 |
"type": "string", |
116 |
"required": True |
|
117 | 111 |
}, |
118 | 112 |
"CodePostal": { |
119 | 113 |
"type": "string", |
120 |
"required": True |
|
121 | 114 |
}, |
122 | 115 |
"Ville": { |
123 | 116 |
"type": "string", |
124 |
"required": True |
|
125 | 117 |
}, |
126 | 118 |
"EncodeKeyStatut": { |
127 | 119 |
"type": "string", |
128 |
"required": True |
|
129 | 120 |
} |
130 | 121 |
} |
131 | 122 |
} |
132 | 123 | |
133 | 124 |
DOCUMENT_SCHEMA = { |
134 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
125 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
135 | 126 |
"title": "AstreGS assocation", |
136 | 127 |
"description": "", |
137 | 128 |
"type": "object", |
129 |
"required": [ |
|
130 |
"Sujet", "Entite", "CodType", "Type", "hdnCodeTrt", "EncodeKeyEntite", "CodeDomaine", |
|
131 |
"CodDom", "document" |
|
132 |
], |
|
138 | 133 |
"properties": { |
139 | 134 |
"Sujet": { |
140 | 135 |
"type": "string", |
141 |
"required": True |
|
142 | 136 |
}, |
143 | 137 |
"Entite": { |
144 | 138 |
"type": "string", |
145 |
"required": True |
|
146 | 139 |
}, |
147 | 140 |
"CodType": { |
148 | 141 |
"type": "string", |
149 |
"required": True |
|
150 | 142 |
}, |
151 | 143 |
"Type": { |
152 | 144 |
"type": "string", |
153 |
"required": True |
|
154 | 145 |
}, |
155 | 146 |
"hdnCodeTrt": { |
156 | 147 |
"type": "string", |
157 |
"required": True |
|
158 | 148 |
}, |
159 | 149 |
"EncodeKeyEntite": { |
160 | 150 |
"type": "string", |
161 |
"required": True |
|
162 | 151 |
}, |
163 | 152 |
"CodeDomaine": { |
164 | 153 |
"type": "string", |
165 |
"required": True |
|
166 | 154 |
}, |
167 | 155 |
"CodDom": { |
168 | 156 |
"type": "string", |
169 |
"required": True |
|
170 | 157 |
}, |
171 | 158 |
"document": { |
172 | 159 |
"required": True, |
173 | 160 |
"type": "object", |
161 |
"required": ['filename', 'content_type', 'content'], |
|
174 | 162 |
'properties': { |
175 | 163 |
'filename': { |
176 | 164 |
'type': 'string', |
177 |
'required': True |
|
178 | 165 |
}, |
179 | 166 |
'content_type': { |
180 | 167 |
'type': 'string', |
181 |
'required': True |
|
182 | 168 |
}, |
183 | 169 |
'content': { |
184 | 170 |
'type': 'string', |
185 |
'required': True |
|
186 | 171 |
} |
187 | 172 |
} |
188 | 173 |
} |
... | ... | |
190 | 175 |
} |
191 | 176 | |
192 | 177 |
GRANT_SCHEMA = { |
193 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
178 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
194 | 179 |
"title": "AstreGS grant", |
195 | 180 |
"description": "", |
196 | 181 |
"type": "object", |
182 |
"required": [ |
|
183 |
"Libelle", "LibelleCourt", "ModGestion", "TypeAide", "Sens", "CodeTiersDem", |
|
184 |
"CodeServiceGestionnaire", "CodeServiceUtilisateur" |
|
185 |
], |
|
197 | 186 |
"properties": { |
198 | 187 |
"Libelle": { |
199 | 188 |
"type": "string", |
200 |
"required": True |
|
201 | 189 |
}, |
202 | 190 |
"LibelleCourt": { |
203 | 191 |
"type": "string", |
204 |
"required": True |
|
205 | 192 |
}, |
206 | 193 |
"ModGestion": { |
207 | 194 |
"type": "string", |
208 |
"required": True, |
|
209 | 195 |
"enum": ["1", "2", "3", "4"] |
210 | 196 |
}, |
211 | 197 |
"TypeAide": { |
212 | 198 |
"type": "string", |
213 |
"required": True |
|
214 | 199 |
}, |
215 | 200 |
"Sens": { |
216 | 201 |
"type": "string", |
217 |
"required": True |
|
218 | 202 |
}, |
219 | 203 |
"CodeTiersDem": { |
220 | 204 |
"type": "string", |
221 |
"required": True |
|
222 | 205 |
}, |
223 | 206 |
"CodeServiceGestionnaire": { |
224 | 207 |
"type": "string", |
225 |
"required": True |
|
226 | 208 |
}, |
227 | 209 |
"CodeServiceUtilisateur": { |
228 | 210 |
"type": "string", |
229 |
"required": True |
|
230 | 211 |
} |
231 | 212 |
} |
232 | 213 |
} |
233 | 214 | |
234 | 215 |
INDANA_SCHEMA = { |
235 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
216 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
236 | 217 |
"title": "AstreGS INDANA indicator", |
237 | 218 |
"description": "", |
238 | 219 |
"type": "object", |
220 |
"required": ["CodeDossier", "CodeInd_1", "AnneeInd_1", "ValInd_1"], |
|
239 | 221 |
"properties": { |
240 | 222 |
"CodeDossier": { |
241 | 223 |
"type": "string", |
242 |
"required": True |
|
243 | 224 |
}, |
244 | 225 |
"CodeInd_1": { |
245 | 226 |
"type": "string", |
246 |
"required": True |
|
247 | 227 |
}, |
248 | 228 |
"AnneeInd_1": { |
249 | 229 |
"type": "string", |
250 |
"required": True |
|
251 | 230 |
}, |
252 | 231 |
"ValInd_1": { |
253 | 232 |
"type": "string", |
254 |
"required": True |
|
255 | 233 |
}, |
256 | 234 |
"IndAide": { |
257 | 235 |
"type": "string", |
258 |
"required": False |
|
259 | 236 |
} |
260 | 237 |
} |
261 | 238 |
} |
262 | 239 | |
263 | 240 |
INDANA_KEY_SCHEMA = { |
264 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
241 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
265 | 242 |
"title": "AstreGS INDANA indicator key", |
266 | 243 |
"description": "", |
267 | 244 |
"type": "object", |
245 |
"required": ["CodeDossier", "CodeInd_1", "AnneeInd_1"], |
|
268 | 246 |
"properties": { |
269 | 247 |
"CodeDossier": { |
270 | 248 |
"type": "string", |
271 |
"required": True |
|
272 | 249 |
}, |
273 | 250 |
"CodeInd_1": { |
274 | 251 |
"type": "string", |
275 |
"required": True |
|
276 | 252 |
}, |
277 | 253 |
"AnneeInd_1": { |
278 | 254 |
"type": "string", |
279 |
"required": True |
|
280 | 255 |
} |
281 | 256 |
} |
282 | 257 |
} |
passerelle/apps/atal/schemas.py | ||
---|---|---|
18 | 18 | |
19 | 19 | |
20 | 20 |
INSERT_DEMANDE_COMPLET_BY_TYPE = { |
21 |
'$schema': 'http://json-schema.org/draft-03/schema#',
|
|
21 |
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
22 | 22 |
'type': 'object', |
23 |
'required': ['type_demande'], |
|
23 | 24 |
'additionalProperties': False, |
24 | 25 |
'properties': { |
25 | 26 |
'type_demande': { |
26 | 27 |
'type': 'string', |
27 |
'required': True, |
|
28 | 28 |
}, |
29 | 29 |
'code_service_demandeur': { |
30 | 30 |
'type': 'string', |
... | ... | |
144 | 144 |
} |
145 | 145 | |
146 | 146 |
INSERT_ACTION_COMMENT = { |
147 |
'$schema': 'http://json-schema.org/draft-03/schema#',
|
|
147 |
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
148 | 148 |
'type': 'object', |
149 |
'required': ['numero_demande', 'commentaire'], |
|
149 | 150 |
'properties': { |
150 | 151 |
'numero_demande': { |
151 | 152 |
'type': 'string', |
152 |
'required': True, |
|
153 | 153 |
}, |
154 | 154 |
'commentaire': { |
155 | 155 |
'type': 'string', |
156 |
'required': True, |
|
157 | 156 |
} |
158 | 157 |
} |
159 | 158 |
} |
160 | 159 | |
161 | 160 |
UPLOAD = { |
162 |
'$schema': 'http://json-schema.org/draft-03/schema#', |
|
163 |
'definitions': { |
|
161 |
'$schema': 'http://json-schema.org/draft-04/schema#', |
|
162 |
'type': 'object', |
|
163 |
'required': ['file', 'numero_demande', 'nom_fichier'], |
|
164 |
'properties': { |
|
164 | 165 |
'file': { |
165 | 166 |
'type': 'object', |
167 |
'required': ['content'], |
|
166 | 168 |
'properties': { |
167 | 169 |
'content': { |
168 | 170 |
'type': 'string', |
169 |
'required': True |
|
170 | 171 |
}, |
171 |
}, |
|
172 |
'required': True |
|
173 |
} |
|
174 |
}, |
|
175 |
'type': 'object', |
|
176 |
'properties': { |
|
177 |
'file': { |
|
178 |
'$ref': '#/definitions/file' |
|
172 |
} |
|
179 | 173 |
}, |
180 | 174 |
'numero_demande': { |
181 | 175 |
'type': 'string', |
182 |
'required': True, |
|
183 | 176 |
}, |
184 | 177 |
'nom_fichier': { |
185 | 178 |
'type': 'string', |
186 |
'required': True, |
|
187 | 179 |
} |
188 | 180 |
} |
189 | 181 |
} |
passerelle/apps/gesbac/models.py | ||
---|---|---|
34 | 34 |
APPLICANT_SCHEMA = OrderedDict(( |
35 | 35 |
("form_id", { |
36 | 36 |
"type": "string", |
37 |
"required": True |
|
38 | 37 |
}), |
39 | 38 |
("demand_date", { |
40 | 39 |
"type": "string", |
41 | 40 |
"pattern": "^[0-9]{8}$", |
42 |
"required": True |
|
43 | 41 |
}), |
44 | 42 |
("demand_time", { |
45 | 43 |
"type": "string", |
46 | 44 |
"pattern": "^[0-9]{6}$", |
47 |
"required": True |
|
48 | 45 |
}), |
49 | 46 |
("producer_code", { |
50 | 47 |
"type": "integer", |
51 |
"required": True |
|
52 | 48 |
}), |
53 | 49 |
("invariant_number", { |
54 | 50 |
"type": "string", |
55 |
"required": False, |
|
56 | 51 |
"maxLength": 10, |
57 | 52 |
"default": "" |
58 | 53 |
}), |
59 | 54 |
("city_insee_code", { |
60 | 55 |
"type": "string", |
61 |
"required": True |
|
62 | 56 |
}), |
63 | 57 |
("street_rivoli_code", { |
64 | 58 |
"type": "string", |
65 |
"required": True |
|
66 | 59 |
}), |
67 | 60 |
("street_name", { |
68 | 61 |
"type": "string", |
69 |
"required": True |
|
70 | 62 |
}), |
71 | 63 |
("address_complement", { |
72 | 64 |
"type": "string", |
73 | 65 |
"maxLength": 32, |
74 |
"required": False, |
|
75 | 66 |
"default": "" |
76 | 67 |
}), |
77 | 68 |
("street_number", { |
78 | 69 |
"type": "integer", |
79 |
"required": False, |
|
80 | 70 |
"default": 0 |
81 | 71 |
}), |
82 | 72 |
("bis_ter", { |
83 | 73 |
"type": "string", |
84 | 74 |
"maxLength": 3, |
85 |
"required": False, |
|
86 | 75 |
"default": "" |
87 | 76 |
}), |
88 | 77 |
("building", { |
89 | 78 |
"type": "string", |
90 | 79 |
"maxLength": 5, |
91 |
"required": False, |
|
92 | 80 |
"default": "" |
93 | 81 |
}), |
94 | 82 |
("hall", { |
95 | 83 |
"type": "string", |
96 | 84 |
"maxLength": 5, |
97 |
"required": False, |
|
98 | 85 |
"default": "" |
99 | 86 |
}), |
100 | 87 |
("appartment_number", { |
101 | 88 |
"type": "string", |
102 | 89 |
"maxLength": 5, |
103 |
"required": False, |
|
104 | 90 |
"default": "" |
105 | 91 |
}), |
106 | 92 |
("producer_social_reason", { |
107 | 93 |
"type": "string", |
108 | 94 |
"maxLength": 38, |
109 |
"required": False, |
|
110 | 95 |
"default": "" |
111 | 96 |
}), |
112 | 97 |
("producer_title_code", { |
113 | 98 |
"type": "integer", |
114 |
"required": False, |
|
115 | 99 |
"default": 0 |
116 | 100 |
}), |
117 | 101 |
("producer_last_name", { |
118 | 102 |
"type": "string", |
119 | 103 |
"maxLength": 38, |
120 |
"required": False, |
|
121 | 104 |
"default": "" |
122 | 105 |
}), |
123 | 106 |
("producer_first_name", { |
124 | 107 |
"type": "string", |
125 | 108 |
"maxLength": 32, |
126 |
"required": False, |
|
127 | 109 |
"default": "" |
128 | 110 |
}), |
129 | 111 |
("producer_phone", { |
130 | 112 |
"type": "string", |
131 | 113 |
"maxLength": 20, |
132 |
"required": False, |
|
133 | 114 |
"default": "" |
134 | 115 |
}), |
135 | 116 |
("producer_email", { |
136 | 117 |
"type": "string", |
137 | 118 |
"maxLength": 50, |
138 |
"required": False, |
|
139 | 119 |
"default": "" |
140 | 120 |
}), |
141 | 121 |
("owner_last_name", { |
142 | 122 |
"type": "string", |
143 | 123 |
"maxLength": 38, |
144 |
"required": False, |
|
145 | 124 |
"default": "" |
146 | 125 |
}), |
147 | 126 |
("owner_first_name", { |
148 | 127 |
"type": "string", |
149 | 128 |
"maxLength": 32, |
150 |
"required": False, |
|
151 | 129 |
"default": "" |
152 | 130 |
}), |
153 | 131 |
("owner_phone", { |
154 | 132 |
"type": "string", |
155 | 133 |
"maxLength": 20, |
156 |
"required": False, |
|
157 | 134 |
"default": "" |
158 | 135 |
}), |
159 | 136 |
("owner_email", { |
160 | 137 |
"type": "string", |
161 | 138 |
"maxLength": 50, |
162 |
"required": False, |
|
163 | 139 |
"default": "" |
164 | 140 |
}), |
165 | 141 |
("activity_code", { |
166 | 142 |
"type": "integer", |
167 |
"required": False, |
|
168 | 143 |
"default": 0 |
169 | 144 |
}), |
170 | 145 |
("family_members_number", { |
171 | 146 |
"type": "integer", |
172 |
"required": False, |
|
173 | 147 |
"default": 0 |
174 | 148 |
}), |
175 | 149 |
("houses_number", { |
176 | 150 |
"type": "integer", |
177 |
"required": False, |
|
178 | 151 |
"default": 0 |
179 | 152 |
}), |
180 | 153 |
("t1_flats_number", { |
181 | 154 |
"type": "integer", |
182 |
"required": False, |
|
183 | 155 |
"default": 0 |
184 | 156 |
}), |
185 | 157 |
("t2_flats_number", { |
186 | 158 |
"type": "integer", |
187 |
"required": False, |
|
188 | 159 |
"default": 0 |
189 | 160 |
}), |
190 | 161 |
("t3_flats_number", { |
191 | 162 |
"type": "integer", |
192 |
"required": False, |
|
193 | 163 |
"default": 0 |
194 | 164 |
}), |
195 | 165 |
("t4_flats_number", { |
196 | 166 |
"type": "integer", |
197 |
"required": False, |
|
198 | 167 |
"default": 0 |
199 | 168 |
}), |
200 | 169 |
("t5_flats_number", { |
201 | 170 |
"type": "integer", |
202 |
"required": False, |
|
203 | 171 |
"default": 0 |
204 | 172 |
}), |
205 | 173 |
("t6_flats_number", { |
206 | 174 |
"type": "integer", |
207 |
"required": False, |
|
208 | 175 |
"default": 0 |
209 | 176 |
}), |
210 | 177 |
("shops_number", { |
211 | 178 |
"type": "integer", |
212 |
"required": False, |
|
213 | 179 |
"default": 0 |
214 | 180 |
}), |
215 | 181 |
("garden_size", { |
216 | 182 |
"type": "integer", |
217 |
"required": False, |
|
218 | 183 |
"default": 0 |
219 | 184 |
}), |
220 | 185 |
("expected_date", { |
221 | 186 |
"type": "string", |
222 | 187 |
"pattern": "^[0-9]{8}$", |
223 |
"required": False, |
|
224 | 188 |
"default": "" |
225 | 189 |
}), |
226 | 190 |
("expected_time", { |
227 | 191 |
"type": "string", |
228 | 192 |
"pattern": "^[0-9]{4}$", |
229 |
"required": False, |
|
230 | 193 |
"default": "" |
231 | 194 |
}), |
232 | 195 |
("modification_code", { |
233 | 196 |
"type": "integer", |
234 |
"required": False, |
|
235 | 197 |
"default": 0 |
236 | 198 |
}), |
237 | 199 |
("demand_reason_label", { |
238 | 200 |
"type": "string", |
239 |
"required": False, |
|
240 | 201 |
"default": "" |
241 | 202 |
}), |
242 | 203 |
("comment", { |
243 | 204 |
"type": "string", |
244 | 205 |
"maxLength": 500, |
245 |
"required": False, |
|
246 | 206 |
"default": "" |
247 | 207 |
})) |
248 | 208 |
) |
... | ... | |
250 | 210 |
CARD_SCHEMA = OrderedDict(( |
251 | 211 |
("card_subject", { |
252 | 212 |
"type": "integer", |
253 |
"required": True |
|
254 | 213 |
}), |
255 | 214 |
("card_type", { |
256 | 215 |
"type": "integer", |
257 |
"required": True |
|
258 | 216 |
}), |
259 | 217 |
("card_demand_reason", { |
260 | 218 |
"type": "integer", |
261 |
"required": True |
|
262 | 219 |
}), |
263 | 220 |
("cards_quantity", { |
264 | 221 |
"type": "integer", |
265 |
"required": True, |
|
266 | 222 | |
267 | 223 |
}), |
268 | 224 |
("card_number", { |
269 | 225 |
"type": "string", |
270 | 226 |
"maxLength": 20, |
271 |
"required": False |
|
272 | 227 |
}), |
273 | 228 |
("card_bar_code", { |
274 | 229 |
"type": "string", |
275 | 230 |
"maxLength": 20, |
276 |
"required": False, |
|
277 | 231 |
"default": "", |
278 | 232 |
}), |
279 | 233 |
("card_code", { |
280 | 234 |
"type": "string", |
281 | 235 |
"maxLength": 20, |
282 |
"required": False, |
|
283 | 236 |
"default": "", |
284 | 237 |
}), |
285 | 238 |
("card_validity_start_date", { |
286 | 239 |
"type": "string", |
287 |
"required": False, |
|
288 | 240 |
"pattern": "^[0-9]{8}$", |
289 | 241 |
"default": "", |
290 | 242 |
}), |
291 | 243 |
("card_validity_end_date", { |
292 | 244 |
"type": "string", |
293 |
"required": False, |
|
294 | 245 |
"pattern": "^[0-9]{8}$", |
295 | 246 |
"default": "", |
296 | 247 |
}), |
297 | 248 |
("card_comment", { |
298 | 249 |
"type": "string", |
299 |
"required": False, |
|
300 | 250 |
"maxLength": 100, |
301 | 251 |
"default": "", |
302 | 252 |
})) |
... | ... | |
306 | 256 |
DEMAND_SCHEMA.update(CARD_SCHEMA) |
307 | 257 | |
308 | 258 |
SCHEMA = { |
309 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
259 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
310 | 260 |
"title": "Gesbac", |
311 | 261 |
"description": "", |
312 | 262 |
"type": "object", |
263 |
"required": [ |
|
264 |
"form_id", "demand_date", "demand_time", "producer_code", "city_insee_code", |
|
265 |
"street_rivoli_code", "street_name", "card_subject", "card_type", "card_demand_reason", |
|
266 |
"cards_quantity" |
|
267 |
], |
|
313 | 268 |
"properties": DEMAND_SCHEMA, |
314 | 269 |
} |
315 | 270 |
passerelle/apps/vivaticket/models.py | ||
---|---|---|
26 | 26 |
from passerelle.utils.jsonresponse import APIError |
27 | 27 | |
28 | 28 |
EVENTBOOK_SCHEMA = { |
29 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
29 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
30 | 30 |
"title": "Vivaticket", |
31 | 31 |
"description": "", |
32 | 32 |
"type": "object", |
33 |
"required": [ |
|
34 |
"id", "email", "start_datetime", "end_datetime", "event", "theme", "room", "quantity", |
|
35 |
"form_url" |
|
36 |
], |
|
33 | 37 |
"properties": { |
34 | 38 |
"id": { |
35 | 39 |
"description": "formdata id", |
36 | 40 |
"type": "string", |
37 |
"required": True |
|
38 | 41 |
}, |
39 | 42 |
"title": { |
40 | 43 |
"description": "user title", |
41 | 44 |
"type": "string", |
42 |
"required": False |
|
43 | 45 |
}, |
44 | 46 |
"last_name": { |
45 | 47 |
"description": "user last name", |
46 | 48 |
"type": "string", |
47 |
"required": False |
|
48 | 49 |
}, |
49 | 50 |
"first_name": { |
50 | 51 |
"description": "user first name", |
51 | 52 |
"type": "string", |
52 |
"required": False |
|
53 | 53 |
}, |
54 | 54 |
"social_reason": { |
55 | 55 |
"description": "user social reason", |
56 | 56 |
"type": "string", |
57 |
"required": False |
|
58 | 57 |
}, |
59 | 58 |
"address": { |
60 | 59 |
"description": "user address", |
61 | 60 |
"type": "string", |
62 |
"required": False |
|
63 | 61 |
}, |
64 | 62 |
"zipcode": { |
65 | 63 |
"description": "user zipcode", |
66 | 64 |
"type": "string", |
67 |
"required": False |
|
68 | 65 |
}, |
69 | 66 |
"city": { |
70 | 67 |
"description": "user city", |
71 | 68 |
"type": "string", |
72 |
"required": False |
|
73 | 69 |
}, |
74 | 70 |
"country": { |
75 | 71 |
"description": "user country", |
76 | 72 |
"type": "string", |
77 |
"required": False |
|
78 | 73 |
}, |
79 | 74 |
"phone": { |
80 | 75 |
"description": "user phone", |
81 | 76 |
"type": "string", |
82 |
"required": False |
|
83 | 77 |
}, |
84 | 78 |
"mobile": { |
85 | 79 |
"description": "user mobile", |
86 | 80 |
"type": "string", |
87 |
"required": False |
|
88 | 81 |
}, |
89 | 82 |
"email": { |
90 | 83 |
"description": "user email", |
91 | 84 |
"type": "string", |
92 |
"required": True |
|
93 | 85 |
}, |
94 | 86 |
"start_datetime": { |
95 | 87 |
"description": "event start datetime", |
96 | 88 |
"type": "string", |
97 | 89 |
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$", |
98 |
"required": True |
|
99 | 90 |
}, |
100 | 91 |
"end_datetime": { |
101 | 92 |
"description": "event end datetime", |
102 | 93 |
"type": "string", |
103 | 94 |
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$", |
104 |
"required": True |
|
105 | 95 |
}, |
106 | 96 |
"event": { |
107 | 97 |
"description": "event id", |
108 | 98 |
"type": "string", |
109 |
"required": True |
|
110 | 99 |
}, |
111 | 100 |
"theme": { |
112 | 101 |
"description": "theme id", |
113 | 102 |
"type": "string", |
114 |
"required": True |
|
115 | 103 |
}, |
116 | 104 |
"room": { |
117 | 105 |
"description": "room id", |
118 | 106 |
"type": "string", |
119 |
"required": True |
|
120 | 107 |
}, |
121 | 108 |
"quantity": { |
122 | 109 |
"description": "quantity", |
123 | 110 |
"type": "integer", |
124 |
"required": True |
|
125 | 111 |
}, |
126 | 112 |
"booking_comment": { |
127 | 113 |
"description": "booking comment", |
128 | 114 |
"type": "string", |
129 |
"required": False, |
|
130 | 115 |
}, |
131 | 116 |
"room_comment": { |
132 | 117 |
"description": "room comment", |
133 | 118 |
"type": "string", |
134 |
"required": False, |
|
135 | 119 |
}, |
136 | 120 |
"form_url": { |
137 | 121 |
"description": "form url", |
138 | 122 |
"type": "string", |
139 |
"required": True |
|
140 | 123 |
}, |
141 | 124 |
"school_level": { |
142 | 125 |
"description": "School Level code", |
143 | 126 |
"type": "string", |
144 |
"required": False |
|
145 | 127 |
} |
146 | 128 |
} |
147 | 129 |
} |
passerelle/contrib/iparapheur/models.py | ||
---|---|---|
30 | 30 | |
31 | 31 | |
32 | 32 |
CREATE_FILE_SCHEMA = { |
33 |
'$schema': 'http://json-schema.org/draft-03/schema#',
|
|
33 |
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
34 | 34 |
'title': 'Iparapheur create file', |
35 |
'definitions': { |
|
35 |
'type': 'object', |
|
36 |
'required': ['file', 'title', 'type', 'subtype', 'visibility'], |
|
37 |
'properties': { |
|
36 | 38 |
'file': { |
37 | 39 |
'type': 'object', |
40 |
'required': ['content', 'content_type'], |
|
38 | 41 |
'properties': { |
39 | 42 |
'content': { |
40 | 43 |
'type': 'string', |
41 |
'required': True |
|
42 | 44 |
}, |
43 | 45 |
'content_type': { |
44 | 46 |
'type': 'string', |
45 |
'required': True |
|
46 | 47 |
} |
47 |
}, |
|
48 |
'required': True |
|
49 |
} |
|
50 |
}, |
|
51 |
'type': 'object', |
|
52 |
'properties': { |
|
53 |
'file': { |
|
54 |
'$ref': '#/definitions/file' |
|
48 |
} |
|
55 | 49 |
}, |
56 | 50 |
'title': { |
57 | 51 |
'type': 'string', |
58 |
'required': True |
|
59 | 52 |
}, |
60 | 53 |
'type': { |
61 | 54 |
'type': 'string', |
62 |
'required': True |
|
63 | 55 |
}, |
64 | 56 |
'subtype': { |
65 | 57 |
'type': 'string', |
66 |
'required': True |
|
67 | 58 |
}, |
68 | 59 |
'email': { |
69 | 60 |
'type': 'string', |
70 | 61 |
}, |
71 | 62 |
'visibility': { |
72 | 63 |
'type': 'string', |
73 |
'required': True |
|
74 | 64 |
} |
75 | 65 |
} |
76 | 66 |
} |
passerelle/contrib/iws/models.py | ||
---|---|---|
35 | 35 |
NS = '{http://isilog.fr}' |
36 | 36 | |
37 | 37 |
BOOKDATE_SCHEMA = { |
38 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
38 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
39 | 39 |
"title": "IWS", |
40 | 40 |
"description": "", |
41 | 41 |
"type": "object", |
42 |
"required": ["firstname", "lastname", "email_notif", "date", "token"], |
|
42 | 43 |
"properties": { |
43 | 44 |
"firstname": { |
44 | 45 |
"description": "Firstname", |
45 | 46 |
"type": "string", |
46 |
"required": True |
|
47 | 47 |
}, |
48 | 48 |
"lastname": { |
49 | 49 |
"description": "Lastname", |
50 | 50 |
"type": "string", |
51 |
"required": True |
|
52 | 51 |
}, |
53 | 52 |
"email": { |
54 | 53 |
"description": "Email", |
... | ... | |
57 | 56 |
"email_notif": { |
58 | 57 |
"description": "Email notification", |
59 | 58 |
"type": "boolean", |
60 |
"required": True |
|
61 | 59 |
}, |
62 | 60 |
"description": { |
63 | 61 |
"description": "Description of the request", |
... | ... | |
70 | 68 |
"date": { |
71 | 69 |
"description": "Booking date", |
72 | 70 |
"type": "string", |
73 |
"required": True |
|
74 | 71 |
}, |
75 | 72 |
"token": { |
76 | 73 |
"description": "Booking token", |
77 | 74 |
"type": "string", |
78 |
"required": True |
|
79 | 75 |
} |
80 | 76 |
} |
81 | 77 |
} |
passerelle/contrib/lille_kimoce/models.py | ||
---|---|---|
27 | 27 | |
28 | 28 | |
29 | 29 |
DEMAND_SCHEMA = { |
30 |
'$schema': 'http://json-schema.org/draft-03/schema#',
|
|
30 |
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
31 | 31 |
'title': 'KIMOCE', |
32 | 32 |
'description': '', |
33 | 33 |
'type': 'object', |
34 |
'required': ['category', 'type', 'subtype', 'form_url', 'first_name', 'last_name', 'email'], |
|
34 | 35 |
'properties': { |
35 | 36 |
'category': { |
36 | 37 |
'description': 'demand category', |
37 | 38 |
'type': 'string', |
38 |
'required': True |
|
39 | 39 |
}, |
40 | 40 |
'type': { |
41 | 41 |
'description': 'demand type', |
42 | 42 |
'type': 'string', |
43 |
'required': True |
|
44 | 43 |
}, |
45 | 44 |
'subtype': { |
46 | 45 |
'description': 'demand sub type', |
47 | 46 |
'type': 'string', |
48 |
'required': True |
|
49 | 47 |
}, |
50 | 48 |
'form_url': { |
51 | 49 |
'description': 'form url', |
52 | 50 |
'type': 'string', |
53 |
'required': True |
|
54 | 51 |
}, |
55 | 52 |
'first_name': { |
56 | 53 |
'description': 'user first name', |
57 | 54 |
'type': 'string', |
58 |
'required': True |
|
59 | 55 |
}, |
60 | 56 |
'last_name': { |
61 | 57 |
'description': 'user last name', |
62 | 58 |
'type': 'string', |
63 |
'required': True |
|
64 | 59 |
}, |
65 | 60 |
'email': { |
66 | 61 |
'description': 'user email', |
67 | 62 |
'type': 'string', |
68 |
'required': True |
|
69 | 63 |
}, |
70 | 64 |
'priorityId': { |
71 | 65 |
'description': 'demand priority', |
72 | 66 |
'type': 'integer', |
73 |
'required': False |
|
74 | 67 |
}, |
75 | 68 |
'city': { |
76 | 69 |
'description': 'demand city', |
77 | 70 |
'type': 'string', |
78 |
'required': False |
|
79 | 71 |
}, |
80 | 72 |
'zipcode': { |
81 | 73 |
'description': 'demand zipcode', |
82 | 74 |
'type': 'string', |
83 |
'required': False |
|
84 | 75 |
}, |
85 | 76 |
'street_number': { |
86 | 77 |
'description': 'demand street number', |
87 | 78 |
'type': 'string', |
88 |
'required': False |
|
89 | 79 |
}, |
90 | 80 |
'street_name': { |
91 | 81 |
'description': 'demand street name', |
92 | 82 |
'type': 'string', |
93 |
'required': False |
|
94 | 83 |
}, |
95 | 84 |
'lat': { |
96 | 85 |
'description': 'demand latitude', |
97 | 86 |
'type': 'string', |
98 |
'required': False |
|
99 | 87 |
}, |
100 | 88 |
'lon': { |
101 | 89 |
'description': 'demand longitude', |
102 | 90 |
'type': 'string', |
103 |
'required': False |
|
104 | 91 |
}, |
105 | 92 |
'picture1': { |
106 | 93 |
'description': 'first picture data', |
107 |
'type': 'any', |
|
108 |
'required': False |
|
109 | 94 |
}, |
110 | 95 |
'picture2': { |
111 | 96 |
'description': 'second picture data', |
112 |
'type': 'any', |
|
113 |
'required': False |
|
114 | 97 |
}, |
115 | 98 |
'comment': { |
116 | 99 |
'description': 'demand comment', |
117 | 100 |
'type': 'string', |
118 |
'required': False |
|
119 | 101 |
} |
120 | 102 |
} |
121 | 103 |
} |
passerelle/contrib/planitech/models.py | ||
---|---|---|
37 | 37 | |
38 | 38 | |
39 | 39 |
CREATE_RESERVATION_SCHEMA = { |
40 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
40 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
41 | 41 |
"title": "Planitech createreservation", |
42 | 42 |
"description": "", |
43 | 43 |
"type": "object", |
44 |
"required": [ |
|
45 |
"date", "start_time", "end_time", "place_id", "price", "name_id", "first_name", |
|
46 |
"last_name", "email", "activity_id", "object", "type_id", "vat_rate" |
|
47 |
], |
|
44 | 48 |
"properties": { |
45 | 49 |
"date": { |
46 | 50 |
"description": "Date", |
47 | 51 |
"type": "string", |
48 |
"required": True |
|
49 | 52 |
}, |
50 | 53 |
"start_time": { |
51 | 54 |
"description": "Start time", |
52 | 55 |
"type": "string", |
53 |
"required": True |
|
54 | 56 |
}, |
55 | 57 |
"end_time": { |
56 | 58 |
"description": "End time", |
57 | 59 |
"type": "string", |
58 |
"required": True |
|
59 | 60 |
}, |
60 | 61 |
"place_id": { |
61 | 62 |
"description": "Place identifier", |
62 | 63 |
"type": "number", |
63 |
"required": True |
|
64 | 64 |
}, |
65 | 65 |
"price": { |
66 | 66 |
"description": "Price", |
67 | 67 |
"type": "number", |
68 |
"required": True |
|
69 | 68 |
}, |
70 | 69 |
"name_id": { |
71 | 70 |
"description": "Publik user nameID", |
72 | 71 |
"type": "string", |
73 |
"required": True |
|
74 | 72 |
}, |
75 | 73 |
"first_name": { |
76 | 74 |
"description": "First name", |
77 | 75 |
"type": "string", |
78 |
"required": True |
|
79 | 76 |
}, |
80 | 77 |
"last_name": { |
81 | 78 |
"description": "Last name", |
82 | 79 |
"type": "string", |
83 |
"required": True |
|
84 | 80 |
}, |
85 | 81 |
"email": { |
86 | 82 |
"description": "Email", |
87 | 83 |
"type": "string", |
88 |
"required": True |
|
89 | 84 |
}, |
90 | 85 |
"activity_id": { |
91 | 86 |
"description": "Activity identifier", |
92 | 87 |
"type": "number", |
93 |
"required": True |
|
94 | 88 |
}, |
95 | 89 |
"object": { |
96 | 90 |
"description": "Object", |
97 | 91 |
"type": "string", |
98 |
"required": True |
|
99 | 92 |
}, |
100 | 93 |
"type_id": { |
101 | 94 |
"description": "Rerservation type identifier", |
102 | 95 |
"type": "number", |
103 |
"required": True |
|
104 | 96 |
}, |
105 | 97 |
"vat_rate": { |
106 | 98 |
"description": "VAT rate", |
107 | 99 |
"type": "number", |
108 |
"required": True |
|
109 | 100 |
}, |
110 | 101 |
"price_code": { |
111 | 102 |
"description": "User price code", |
112 | 103 |
"type": "string", |
113 |
"required": False |
|
114 | 104 |
} |
115 | 105 |
} |
116 | 106 |
} |
117 | 107 | |
118 | 108 | |
119 | 109 |
GET_RESERVATION_PRICE_SCHEMA = { |
120 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
110 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
121 | 111 |
"title": "Planitech getreservationprice", |
122 | 112 |
"description": "", |
123 | 113 |
"type": "object", |
114 |
"required": [ |
|
115 |
"date", "start_time", "end_time", "place_id", "name_id", "first_name", "last_name", |
|
116 |
"email", "activity_id", "type_id" |
|
117 |
], |
|
124 | 118 |
"properties": { |
125 | 119 |
"date": { |
126 | 120 |
"description": "Date", |
127 | 121 |
"type": "string", |
128 |
"required": True |
|
129 | 122 |
}, |
130 | 123 |
"start_time": { |
131 | 124 |
"description": "Start time", |
132 | 125 |
"type": "string", |
133 |
"required": True |
|
134 | 126 |
}, |
135 | 127 |
"end_time": { |
136 | 128 |
"description": "End time", |
137 | 129 |
"type": "string", |
138 |
"required": True |
|
139 | 130 |
}, |
140 | 131 |
"place_id": { |
141 | 132 |
"description": "Place identifier", |
142 | 133 |
"type": "number", |
143 |
"required": True |
|
144 | 134 |
}, |
145 | 135 |
"name_id": { |
146 | 136 |
"description": "Publik user nameID", |
147 | 137 |
"type": "string", |
148 |
"required": True |
|
149 | 138 |
}, |
150 | 139 |
"first_name": { |
151 | 140 |
"description": "First name", |
152 | 141 |
"type": "string", |
153 |
"required": True |
|
154 | 142 |
}, |
155 | 143 |
"last_name": { |
156 | 144 |
"description": "Last name", |
157 | 145 |
"type": "string", |
158 |
"required": True |
|
159 | 146 |
}, |
160 | 147 |
"email": { |
161 | 148 |
"description": "Email", |
162 | 149 |
"type": "string", |
163 |
"required": True |
|
164 | 150 |
}, |
165 | 151 |
"activity_id": { |
166 | 152 |
"description": "Activity identifier", |
167 | 153 |
"type": "number", |
168 |
"required": True |
|
169 | 154 |
}, |
170 | 155 |
"type_id": { |
171 | 156 |
"description": "Rerservation type identifier", |
172 | 157 |
"type": "number", |
173 |
"required": True |
|
174 | 158 |
}, |
175 | 159 |
"price_code": { |
176 | 160 |
"description": "User price code", |
177 | 161 |
"type": "string", |
178 |
"required": False |
|
179 | 162 |
} |
180 | 163 |
} |
181 | 164 |
} |
... | ... | |
186 | 169 |
} |
187 | 170 | |
188 | 171 |
UPDATE_RESERVATION_SCHEMA = { |
189 |
"$schema": "http://json-schema.org/draft-03/schema#",
|
|
172 |
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
190 | 173 |
"title": "Planitech updatereservation", |
191 | 174 |
"description": "", |
192 | 175 |
"type": "object", |
176 |
"required": ["reservation_id", "status"], |
|
193 | 177 |
"properties": { |
194 | 178 |
"reservation_id": { |
195 | 179 |
"description": "Reservation Identifier", |
196 | 180 |
"type": "number", |
197 |
"required": True |
|
198 | 181 |
}, |
199 | 182 |
"status": { |
200 | 183 |
"description": "Status of the reservation", |
201 | 184 |
"type": "string", |
202 |
"required": True, |
|
203 | 185 |
"enum": list(RESERVATION_STATUS.keys()) |
204 | 186 |
} |
205 | 187 |
} |
tests/test_atal.py | ||
---|---|---|
178 | 178 |
'err_desc': 'Invalid base64 string' |
179 | 179 |
} |
180 | 180 | |
181 |
# empty file |
|
182 |
params = { |
|
183 |
'numero_demande': 'DIT19050001', |
|
184 |
'nom_fichier': 'data.json', |
|
185 |
'file': {} |
|
186 |
} |
|
187 |
response = app.post_json('/atal/slug-atal/upload', params=params, status=400) |
|
188 |
assert response.json == { |
|
189 |
'data': None, |
|
190 |
'err': 1, |
|
191 |
'err_class': 'passerelle.utils.jsonresponse.APIError', |
|
192 |
'err_desc': "'content' is a required property" |
|
193 |
} |
|
194 | ||
195 |
# no file |
|
196 |
params = { |
|
197 |
'numero_demande': 'DIT19050001', |
|
198 |
'nom_fichier': 'data.json' |
|
199 |
} |
|
200 |
response = app.post_json('/atal/slug-atal/upload', params=params, status=400) |
|
201 |
assert response.json == { |
|
202 |
'data': None, |
|
203 |
'err': 1, |
|
204 |
'err_class': 'passerelle.utils.jsonresponse.APIError', |
|
205 |
'err_desc': "'file' is a required property" |
|
206 |
} |
|
207 | ||
181 | 208 | |
182 | 209 |
def test_retrieve_details_demande(app, connector, monkeypatch): |
183 | 210 |
import passerelle.utils |
184 |
- |