Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show min and max values for a field on the docs page #31

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 10 additions & 2 deletions src/app/api/v1/rvv/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand All @@ -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",
},
Expand Down
35 changes: 28 additions & 7 deletions src/app/api/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand All @@ -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",
},
Expand All @@ -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",
},
Expand All @@ -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",
Expand All @@ -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",
},
Expand Down Expand Up @@ -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",
},
Expand Down