The Swagger file at https://api.tfl.gov.uk/swagger/docs/v1 seems to refer to the (somewhat outdated) https://api.tfl.gov.uk/swagger/ui/index.html instead of the newer https://api-portal.tfl.gov.uk/apis.
If you paste it into a swagger editor, you can see many issues:
- Some path parameters are declared as query parameters (example)
- There are some duplicated parameters (e.g.
startDate
anddateRange.startDate
at api.tfl.gov.uk as opposed to at api-portal.tfl.gov.uk) - There are different paths have the same
operationId
(Occupancy_Get and Occupancy_Get_0 (though the _0 is missing in the swagger doc) as opposed to Occupancy_Get and Occupancy_GetByPathId). - Other, non-conflicting
operationID
s have also been changed: Line_Status vs Line_StatusByPathIdsPathStartDatePathEndDateQueryDetail.
Note: the LineStatus
path isn’t the only path with most of these issues, but it does show them clearly.
I ran into these issues after realising that none of the response attributes are marked as required, implying every field in the response could be undefined
/ missing, which causes issues when using the Swagger file to generate TypeScript files. (see issue on Github for more detail). Request fields are properly marked as required/optional, while response fields are not. I started looking into modifying the Swagger file myself before coming across these inconsistencies.
I therefore have 2 requests:
- Is there any updated Swagger file available which is consistent with https://api-portal.tfl.gov.uk/apis?
- Is it possible to have the latest available Swagger file updated to include
required
definitions for the response types?