Skip to content

Validate conditional presence of station/vehicle feeds in gbfs.json - #208

Merged
jcpitre merged 1 commit into
MobilityData:masterfrom
entur:validate-conditional-feed-presence
Aug 14, 2026
Merged

Validate conditional presence of station/vehicle feeds in gbfs.json#208
jcpitre merged 1 commit into
MobilityData:masterfrom
entur:validate-conditional-feed-presence

Conversation

@testower

@testower testower commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Closes #180

What

Adds two conditional feed-presence rules to the gbfs.json feeds array, as an allOf sibling of the existing system_information contains constraint, using draft-07 contains + anyOf/if/then:

  1. At least one modefeeds MUST contain at least one of station_status or the free-floating feed (vehicle_status in v3.x, free_bike_status in v2.x).
  2. Station pairing — IF station_information is declared, station_status MUST also be declared.

Applied to v2.0, v2.1, v2.2, v2.3, v3.0, v3.1-RC3.

Notes

  • The added keywords are validation-only. Verified that the committed Go model regenerates byte-identical, and the Java (jsonschema2pojo) and TypeScript (quicktype) builds + tests pass unchanged — so no model regeneration is required.
  • testFixtures/v3.1-RC3/gbfs.json declared station_information without station_status (now invalid under rule 2, and consumed by the TypeScript test) and gains the missing station_status entry.

Verification

  • 30-case validation harness (valid/invalid instances × 6 versions) — all pass
  • All 6 schemas valid draft-07
  • Fixed fixture validates against its schema
  • Java model build: 67 tests, 0 failures · TypeScript: 38 tests pass · Go model: regenerates byte-identical

@testower
testower marked this pull request as draft July 24, 2026 11:35
@testower
testower force-pushed the validate-conditional-feed-presence branch from c53535c to a4c2dba Compare July 24, 2026 11:45
Encode two spec rules on the gbfs.json feeds array, as an allOf sibling of
the existing system_information `contains` constraint, using draft-07
contains + anyOf/if/then:

* At least one of station_status or the free-floating feed (vehicle_status
  in v3.x, free_bike_status in v2.x) must be present.
* If station_information is declared, station_status must also be declared.

Applied to v2.0-v2.3, v3.0 and v3.1-RC3. The keywords are validation-only,
so generated TS/Go/Java models are unaffected.

testFixtures/v3.1-RC3/gbfs.json declared station_information without
station_status (now invalid) and gains the missing station_status entry.

Closes MobilityData#180
@testower
testower force-pushed the validate-conditional-feed-presence branch from a4c2dba to eccc143 Compare July 24, 2026 11:53
@testower
testower marked this pull request as ready for review July 24, 2026 11:57

@richfab richfab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @testower for this great addition to the GBFS JSON Schemas!

The manual tests I ran with https://www.jsonschemavalidator.net/ passed for all versions.

LGTM! I will let the dev team take care of the merge.

@jcpitre jcpitre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!
I would like to know more about this 30-case validation harness

@jcpitre
jcpitre merged commit 2e974fd into MobilityData:master Aug 14, 2026
@jcpitre

jcpitre commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Auto release did not work (opened ain issue for that: #209)
Released by hand as v4.4.0

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 this pull request may close these issues.

Validate conditionally the presence of station_information, station_status and vehicle_status in gbfs.json

4 participants