Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to data structures #407

Merged
merged 5 commits into from
Jan 23, 2023
Merged

Changes to data structures #407

merged 5 commits into from
Jan 23, 2023

Conversation

mplsmitch
Copy link
Collaborator

What problem does your proposal solve? Please begin with the relevant issue number. If there is no existing issue, please also describe alternative solutions you have considered.

We have two fields,vehicle_type_area_capacity and vehicle_type_dock_capacity that use data from other fields as object keys. This is inconsistent with other similar fields in the specification such as vehicle_types_available and has caused some challenges in generating models and validation.

What is the proposal?

This proposal changes the objects to arrays as was done with vehicle_types _available. I've read through the rest of the specification and haven't found this issue elsewhere. If anyone is aware other examples please chime in so we can roll them into this PR.

Is this a breaking change?

  • Yes
  • No
  • Unsure

Which files are affected by this change?

Mitch Vars added 2 commits February 4, 2022 11:07
Changes objects vehicle_type_dock_capacity and vehicle_type_area_capacity to arrays.
formatting fixes to JSON examples
@mplsmitch mplsmitch added the v3.0-RC Candidate change for GBFS 3.0 (Major release) label Feb 23, 2022
@stale
Copy link

stale bot commented Jun 24, 2022

This discussion has been automatically marked as stale because it has not had recent activity. It will be closed in 60 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 24, 2022
@mplsmitch mplsmitch removed the stale label Jun 29, 2022
@testower
Copy link
Contributor

Entur supports this change

@testower
Copy link
Contributor

@mplsmitch How can we move this forward? Call to vote?

@mplsmitch
Copy link
Collaborator Author

Hello @testower - the next step is to call a vote on this along with #454, #457 and #460 and anything else we'd like to get into the v3.0 release. In the past we've made the most progress if we group the votes an a number of issues, as opposed to holding individual votes. The PRs need to be open for comment for 7 days before a vote can be called.

I'd like to do something about #306, basically it would be like your file: https://api.entur.io/mobility/v2/gbfs/
I should be able to write it up today and get a PR open.

Great work on the Internationalization!

@josee-sabourin
Copy link
Contributor

I hereby call a vote on this proposal. Voting will be open for 10 full calendar days until 11:59PM UTC on Friday, January 20th.

Please vote for or against the proposal, and include the organization for which you are voting in your comment.

Please note if you can commit to implementing the proposal.

@cmonagle
Copy link
Contributor

+1 from Transit

@testower
Copy link
Contributor

+1 from Entur

gbfs.md Outdated
"abc123": 7,
"def456": 9
}
"is_charging_station": "true",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to stringify true here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a mistake - will fix when/if we merge.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question, but why not fix it now? Isn't it better to be precise on what we are voting for?

gbfs.md Outdated
\-&nbsp;`vehicle_type_area_capacity` <br/>*(added in v2.1)* | OPTIONAL | Object | An object used to describe the parking capacity of virtual stations (defined using the `is_virtual_station` field), where each key is a `vehicle_type_id` as described in [vehicle_types.json](#vehicle_typesjson) and the value is a number representing the total number of vehicles of this type that can park within the virtual station.<br/><br/>If the virtual station is defined by `station_area`, this is the number that can park within the station area. If `lat`/`lon` is defined, this is the number that can park at those coordinates.
\-&nbsp;`vehicle_type_dock_capacity` <br/>*(added in v2.1)* | OPTIONAL | Object | An object used to describe the docking capacity of a station where each key is a `vehicle_type_id` as described in [vehicle_types.json](#vehicle_typesjson) and the value is a number representing the total docking points installed at this station, both available and unavailable for the specified vehicle type.
\-&nbsp;`vehicle_type_area_capacity` <br/>*(as of v3.0)* | OPTIONAL | Array| This field's value is an array of objects containing the keys `vehicle_type_id` and `count` defined below. These objects are used to model the parking capacity of virtual stations (defined using the `is_virtual_station` field) for each vehicle type defined in `vehicle_types.json`.
&emsp;&emsp;\-&nbsp;`vehicle_type_id`| Conditionally REQUIRED | ID | A `vehicle_type_id`, as defined in `vehicle_types.json`, that may park at the virtual station.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question, but why is this "Conditionally Required"? Under what conditions would it be left empty? Same for count field below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are required if vehicle_type_area_capacity is used, if not, they are not required. We can clarify this when/if we merge.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the convention in the spec for a field that is required if its parent element is specified, where the parent element may be optional? If I understand correctly, in this PR the required child fields are being marked as "Conditionally Required". However, I see in PR #460 that newly added child fields are being marked simply as "Required", even if there parent element is optional. I'll admit the latter convention seems more natural to me, but understood if that's not the convention used in the spec.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed response, I've been traveling and just got back. I'll update the PR with corrections. @bdferris-v2 you have a good point, we need to be consistent on how parent-child relationships are described throughout. I think you are correct that they should be labeled simply as required in this case because we could have parent-child relationships with other dependencies making them conditionally required. Making these consistent throughout the spec wouldn't change the behavior of any fields so it won't require a vote. We should just go ahead and do it now so it can get rolled into the next release.

Some day I want to write a style guide that would contain all these conventions.

Change child fields of optional parent from Conditionally Required to Required.  Change incorrect string to boolean.
Needed for PR #457
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Mitch Vars
❌ mplsmitch


Mitch Vars seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@josee-sabourin
Copy link
Contributor

Voting on this PR closes in 2 calendar days. Please vote for or against the proposal, and include the organization for which you are voting in your comment. Please note if you can commit to implementing the proposal.

gbfs.md Outdated Show resolved Hide resolved
* Change child field requirements, remove string

Change child fields of optional parent from Conditionally Required to Required.  Change incorrect string to boolean.

* fix typo in vehicle_type_dock_capacity
@rootsixtysix
Copy link

+1 for harmonization of data structure from nextbike

@kheraankit
Copy link

+1 form Lime

@benwedge
Copy link

+1 from Joyride

@cait32
Copy link

cait32 commented Jan 19, 2023

+1 from BCycle

@josee-sabourin
Copy link
Contributor

This vote has now closed, and it passes!

Votes in favor:
Transit (consumer)
Entur (consumer)
Nextbike (producer)
Lime (producer)
Joyride (producer)
BCycle (producer)

There were no votes against.
Thank you to everyone who took the time to review and to vote on this! We incorporate it into 3.0-RC, which should be ready to go in the coming week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3.0-RC Candidate change for GBFS 3.0 (Major release) Vote Passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants