Incorrect type for 'children' property in StopPoint swagger spec?

The Swagger documentation for the endpoint /StopPoint/{ids} states that a ‘Place’ type will be returned for the ‘children’ property in a StopPoint. However it seems that the type is actually a ‘StopPoint’

"children": [
      {
        "$type": "Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities",
        "naptanId": "9100ACOCKSG",
        "modes": [
          "national-rail"
        ],
...

For example https://api.tfl.gov.uk/StopPoint/910GACOCKSG,910GBGRN

Make sense to me, but perhaps the swagger specification is wrong and needs updating?

Hi,

I note there’s been no response to this since April 2018, but I am seeing the same problem. I have used the Swagger spec to generate a Java client API, and am unable to do a /StopPoint/StopPoint_Get for any stop that is a NaptanBusCoachStation, which has child StopPoints, because the generated code is expecting a Place, as per the spec, but what is returned in children as StopPoints. I suspect this is because StopPoint is actually a sub-class of Place, but no inheritance/discriminators are defined in the Swagger spec.

Did you find any workaround, Malcolm? Or can someone from TfL Tech comment?

Thanks,
Nick

@jamesevans might be able to help.

I would personally think that what you get back is right and the documentation is wrong.

We do have a ticket in the backlog for this (SVC-4598). I’ll see if we can get it into a sprint to look at.

Thanks,
James

1 Like

Hi James,

That’d be great, thanks!

On a related note, calls to /StopPoint/StopPoint_GetByType return children as a list of Places, whereas /StopPoint/StopPoint_Get returns children as a list of StopPoints. Not sure whether this is intended or not? But this means that, even if the swagger file is updated with details of subtypes, one would have to call /StopPoint/StopPoint_GetByType to get all the bus stops, and then call /StopPoint/StopPoint_Get for any IDs that have children (414 records including NaptanBusCoachStations), in order to get the StopPoints needed.

Thanks,
Nick

On a related note, calls to /StopPoint/StopPoint_GetByType return children as a list of Places

This doesn’t appear to be happening for me now. If it’s been fixed, thank you very much! And if not, then I’m somewhat mystified. But either way, it looks good - I am seeing StopPoints returned from this call now.

1 Like