From 8212ecc182c64069bebe73256da0185c70088c5d Mon Sep 17 00:00:00 2001 From: Sidney Gijzen Date: Wed, 26 Jun 2024 15:38:07 +0200 Subject: [PATCH 1/2] show min and max values for a field on the docs page --- src/app/api/v1/rvv/location.py | 12 ++++++++++-- src/app/api/validation.py | 35 +++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/app/api/v1/rvv/location.py b/src/app/api/v1/rvv/location.py index 39d1d4d..8a65d4a 100644 --- a/src/app/api/v1/rvv/location.py +++ b/src/app/api/v1/rvv/location.py @@ -11,7 +11,11 @@ class RvvLocationValidationSchema(VehicleValidationSchema): lat = fields.Float( metadata={ - "description": "De latitude van de locatie", + "description": ( + "De latitude van de locatie. " + f"Min. {bbox['lat']['min']}, " + f"max. {bbox['lat']['max']}" + ), "example": 52.109, "title": "Latitude", }, @@ -23,7 +27,11 @@ class RvvLocationValidationSchema(VehicleValidationSchema): lon = fields.Float( metadata={ - "description": "De longitude van de locatie", + "description": ( + "De longitude van de locatie. " + f"Min. {bbox['lon']['min']}, " + f"max. {bbox['lon']['max']}" + ), "example": 5.1, "title": "Longitude", }, diff --git a/src/app/api/validation.py b/src/app/api/validation.py index 519b4d2..17860b3 100644 --- a/src/app/api/validation.py +++ b/src/app/api/validation.py @@ -37,7 +37,11 @@ class VehicleValidationSchema(Schema): voertuigAslast = fields.Integer( metadata={ - "description": "De aslast van het voertuig in kilogram", + "description": ( + "De aslast van het voertuig in kilogram. " + f"Min. {vehicle['axleWeight']['min']}, " + f"max. {vehicle['axleWeight']['max']}" + ), "example": 10000, "title": "Aslast van het voertuig", }, @@ -61,7 +65,11 @@ class VehicleValidationSchema(Schema): voertuigHoogte = fields.Float( metadata={ - "description": "De hoogte van het voertuig in meters", + "description": ( + "De hoogte van het voertuig in meters. " + f"Min. {vehicle['height']['min'] + 0.01}, " + f"max. {vehicle['height']['max']}" + ), "example": 3.13, "title": "Hoogte van het voertuig", }, @@ -77,7 +85,11 @@ class VehicleValidationSchema(Schema): voertuigLengte = fields.Float( metadata={ - "description": "De lengte van het voertuig in meters", + "description": ( + "De lengte van het voertuig in meters. " + f"Min. {vehicle['length']['min']}, " + f"max. {vehicle['length']['max']}" + ), "example": 13.95, "title": "Lengte van het voertuig", }, @@ -92,8 +104,9 @@ class VehicleValidationSchema(Schema): voertuigToegestaanMaximaalGewicht = fields.Integer( metadata={ "description": ( - "Het maximaal toegestane gewicht " - "van het voertuig in kilogram" + "Het maximaal toegestane gewicht van het voertuig in kilogram." + f" Min. {vehicle['maxAllowedWeight']['min']}, " + f"max. {vehicle['maxAllowedWeight']['max']}" ), "example": 24600, "title": "Maximaal toegestane gewicht van het voertuig", @@ -109,7 +122,11 @@ class VehicleValidationSchema(Schema): voertuigTotaalGewicht = fields.Integer( metadata={ - "description": "Het totale gewicht van het voertuig in kilogram", + "description": ( + "Het totale gewicht van het voertuig in kilogram. " + f"Min. {vehicle['totalWeight']['min']}, " + f"max. {vehicle['totalWeight']['max']}" + ), "example": 22150, "title": "Totale gewicht van het voertuig", }, @@ -140,7 +157,11 @@ def allowed_vehicle_types(self, value): voertuigBreedte = fields.Float( metadata={ - "description": "De breedte van het voertuig in meters", + "description": ( + "De breedte van het voertuig in meters. " + f"Min. {vehicle['width']['min']}, " + f"max. {vehicle['width']['max']}" + ), "example": 2.55, "title": "Breedte van het voertuig", }, From 2d4ebf53b4770601b6bb01211d0837063b8325df Mon Sep 17 00:00:00 2001 From: Sidney Gijzen Date: Wed, 26 Jun 2024 15:43:42 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab74437..a7b04da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased](https://github.com/GemeenteUtrecht/bereikbaarheid-backend/compare/v0.5.9...HEAD) +### Changed +- show min and max values for a field on the `/docs` page + ## [v0.5.9](https://github.com/GemeenteUtrecht/bereikbaarheid-backend/compare/v0.5.8...v0.5.9) - 2024-06-06