openmobilityfoundation / mobility-data-specification

A data standard to enable right-of-way regulation and two-way communication between mobility companies and local governments.
https://www.openmobilityfoundation.org/about-mds/
Other
676 stars 232 forks source link

Provider and Policy GET data payloads vs. other data payloads #841

Closed thekaveman closed 1 year ago

thekaveman commented 1 year ago

Issue

Provider defines the data payload under the data top-level key, with an endpoint-specific key that holds the array of items:

{
    "version": "2.0.0",
    "data": {
        "vehicles": [
             // vehicle objects here
         ]
     }
}

This differs from e.g. Agency and Geographies, which define their GET payloads as top-level keys on their own, without the addition of the data layer:

{
    "version": "2.0.0",
    "vehicles": [
        // vehicle objects here
     ]
}

Suggestion

Align Provider with the other APIs, by removing the additional data layer in the response payload, and returning the actual data items as a top-level key, like in Agency and Geographies.

schnuerle commented 1 year ago

Is Provider the only one like this? What about Metrics, Policy, Jurisdiction? If provider is the only one using data I'd say we should change it too.

cc @marie-x

marie-x commented 1 year ago

Agree with @thekaveman

thekaveman commented 1 year ago

Policy

Defines it like Provider does, with a top-level data key:

{
  "version": "x.y.z",
  "updated": 1570035222868,
  "data": {
     "policies": [ ... ]
  }
}

Suggest to change this to the same style as we are talking about here for Provider.

Jurisdiction

Defines it like Agency and Geographies, at the top-level (based on what is shown in the examples):

{
    "version": "1.2.0",
    "updated": "1570035222868",
    "end_date": "1570035222868",
    "jurisdictions": [ ... ]
}

This is the style we should align Provider and Policy to.

Metrics

Everything is at the top-level and the response format is pretty different from other MDS APIs.

No need to change anything here.

thekaveman commented 1 year ago

This is being handled for Provider in OpenAPI in openmobilityfoundation/mds-openapi#5

schnuerle commented 1 year ago

I will work to make this change in the MDS spec.

schnuerle commented 1 year ago

Fixed this by removing the data level across Provider and Policy in this commit. Can close this issue upon @thekaveman review.

thekaveman commented 1 year ago

Yep looks good 👍