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

Validate uniqueness of values in Arrays of IDs #99

Open
richfab opened this issue Nov 9, 2023 · 1 comment · Fixed by #102
Open

Validate uniqueness of values in Arrays of IDs #99

richfab opened this issue Nov 9, 2023 · 1 comment · Fixed by #102
Assignees

Comments

@richfab
Copy link
Contributor

richfab commented Nov 9, 2023

Problem

Currently, the JSON Schema does not throw any error when fields that are an Array of IDs contain duplicate IDs.

Even though the GBFS spec does not say anything about this, it is common practice that identifiers in an Array MUST be unique.

Solution

The rule to validate the uniqueness of values in Arrays of IDs can be added to the JSON schemas using #uniqueItems.

List of fields for which this rule applies:

- vehicle_types.json#vehicle_types.pricing_plan_ids
- station_status.json#stations.vehicle_docks_available.vehicle_type_ids
- system_alerts.json#alerts.station_ids
- system_alerts.json#alerts.region_ids
- geofencing_zones.json#geofencing_zones.features.properties.rules.vehicle_type_ids
- geofencing_zones.json#geofencing_zones.global_rules.vehicle_type_ids
- station_information.json#stations.vehicle_types_capacity.vehicle_type_ids
- station_information.json#stations.vehicle_docks_capacity.vehicle_type_ids
@richfab
Copy link
Contributor Author

richfab commented Nov 22, 2023

Reopening this issue as more thought is needed since this validation rule is a best practice, not explicitly written in the specs.

@richfab richfab reopened this Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant