Skip to content

[Policy API] Response when returning a single object is not clear #599

@fractalf

Description

@fractalf

Ref: https://github.com/openmobilityfoundation/mobility-data-specification/blob/main/policy/README.md#rest-endpoints

I think the specs should be more clear about how the exact response should be when it comes to returning a single object vs multiple. In fact, each of these cases should have their own little section:

  • /policies
  • /policies/{id}
  • /geographies
  • /geographies/{id}

When "bundling" the docs on single/multiple endpoints, confusion and conflicts arise. An example: id is listed as a query parameter along with start_date and end_date. Though this is not really a query parameter, but part of the endpoint.

I studied the code in mds-core and found some undocumented responses when it comes to single objects

/policies

        res.status(200).send({ version: res.locals.version, data: { policies: active } })

=> Would produce expected result according to docs

/policies/{id}

        res.status(200).send({ version: res.locals.version, data: { policy } })

=> Would produce something not expected or documentet, the data object would contain a policy property

/geographies

        return res.status(200).send({ version: res.locals.version, data: { geographies } })

=> Would produce expected result according to docs

/geographies/{id}

        return res.status(200).send({ version: res.locals.version, data: { geography } })

=> Would produce something not expected or documentet, the data object would contain a geography property

Thank you

Metadata

Metadata

Assignees

Labels

PolicySpecific to the Policy APIbugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions