Specified coordinates types
MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingstations-get.json
src/assets/server/rest/v1/schemas/chargingstation/chargingstations-get.json
},
"LocLongitude": {
"type": "number",
- "format": "coordinates",
+ "format": "longitude",
"sanitize": "mongo"
},
"LocLatitude": {
"type": "number",
- "format": "coordinates",
+ "format": "latitude",
"sanitize": "mongo"
},
"LocMaxDistanceMeters": {

MODIFY
src/server/rest/v1/validator/SchemaValidator.ts
src/server/rest/v1/validator/SchemaValidator.ts
@@ -31,9 +31,13 @@ export default class SchemaValidator {
coerceTypes: true
}) {
this.ajv = ajvSanitizer(new Ajv(config), extraSanitizers);
- this.ajv.addFormat('coordinates', {
+ this.ajv.addFormat('latitude', {
type: 'number',
- validate: (c) => Constants.REGEX_VALIDATION_LATITUDE.test(c.toString()) || Constants.REGEX_VALIDATION_LONGITUDE.test(c.toString())
+ validate: (c) => Constants.REGEX_VALIDATION_LATITUDE.test(c.toString())
+ });
+ this.ajv.addFormat('longitude', {
+ type: 'number',
+ validate: (c) => Constants.REGEX_VALIDATION_LONGITUDE.test(c.toString())
});
this.ajv.addSchema(this.commonSchema);
this.ajv.addSchema(this.tenantComponentSchema);

Specified coordinates types