Skip to content

Commit

Permalink
🩹(api) improve Swagger data examples
Browse files Browse the repository at this point in the history
Swagger auto-generated example fields given a regex are often confusing.
We've added some real life example to ease our users' life.
  • Loading branch information
jmaupetit committed Jul 16, 2024
1 parent ae17843 commit b96c617
Show file tree
Hide file tree
Showing 3 changed files with 455 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ and this project adheres to
- Upgrade geoalchemy2 to `0.15.2`
- Upgrade sentry-sdk to `2.10.0`

### Fixed

- Add relevant data examples for Swagger

## [0.10.0] - 2024-07-01

### Changed
Expand Down
10 changes: 8 additions & 2 deletions src/api/qualicharge/models/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class StatusCreate(StatusBase):
"""Point of charge status create."""

id_pdc_itinerance: str = Field(
regex="(?:(?:^|,)(^[A-Z]{2}[A-Z0-9]{4,33}$|Non concerné))+$"
regex="(?:(?:^|,)(^[A-Z]{2}[A-Z0-9]{4,33}$|Non concerné))+$",
schema_extra={
"examples": ["FR0NXEVSEXB9YG", "FRFASE3300405", "FR073012308585"]
},
)


Expand All @@ -69,5 +72,8 @@ class SessionCreate(SessionBase):
"""Point of charge sessions create."""

id_pdc_itinerance: str = Field(
regex="(?:(?:^|,)(^[A-Z]{2}[A-Z0-9]{4,33}$|Non concerné))+$"
regex="(?:(?:^|,)(^[A-Z]{2}[A-Z0-9]{4,33}$|Non concerné))+$",
schema_extra={
"examples": ["FR0NXEVSEXB9YG", "FRFASE3300405", "FR073012308585"]
},
)
Loading

0 comments on commit b96c617

Please sign in to comment.