-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add 2.3 typescript models * update release version
- Loading branch information
1 parent
747c717
commit 9d367f0
Showing
19 changed files
with
612 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
v2.3/* | ||
!v2.3/index.d.ts | ||
v3.0/* | ||
!v3.0/index.d.ts | ||
v3.1-RC/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * as v3 from './v3.0'; | ||
export * as v31rc from './v3.1-RC'; | ||
export * as v23 from "./v2.3"; | ||
export * as v3 from "./v3.0"; | ||
export * as v31rc from "./v3.1-RC"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import { createCheckers } from "ts-interface-checker"; | ||
|
||
// checker model | ||
import FreeBikeStatusTI from "../v2.3/test-type-checkers/free_bike_status-ti"; | ||
import GbfsVersionsTI from "../v2.3/test-type-checkers/gbfs_versions-ti"; | ||
import GbfsTI from "../v2.3/test-type-checkers/gbfs-ti"; | ||
import GeofencingZonesTI from "../v2.3/test-type-checkers/geofencing_zones-ti"; | ||
import StationsInformationTI from "../v2.3/test-type-checkers/station_information-ti"; | ||
import StationStatusTI from "../v2.3/test-type-checkers/station_status-ti"; | ||
import SystemAlertsTI from "../v2.3/test-type-checkers/system_alerts-ti"; | ||
import SystemCalendarTI from "../v2.3/test-type-checkers/system_calendar-ti"; | ||
import SystemHoursTI from "../v2.3/test-type-checkers/system_hours-ti"; | ||
import SystemInformationTI from "../v2.3/test-type-checkers/system_information-ti"; | ||
import SystemPricingPlansTI from "../v2.3/test-type-checkers/system_pricing_plans-ti"; | ||
import SystemRegionsTI from "../v2.3/test-type-checkers/system_regions-ti"; | ||
import VehicleTypesTI from "../v2.3/test-type-checkers/vehicle_types-ti"; | ||
|
||
// checkers | ||
const { FreeBikeStatus } = createCheckers(FreeBikeStatusTI); | ||
const { GbfsVersions } = createCheckers(GbfsVersionsTI); | ||
const { Gbfs } = createCheckers(GbfsTI); | ||
const { GeofencingZones } = createCheckers(GeofencingZonesTI); | ||
const { StationInformation } = createCheckers(StationsInformationTI); | ||
const { StationStatus } = createCheckers(StationStatusTI); | ||
const { SystemAlerts } = createCheckers(SystemAlertsTI); | ||
const { SystemCalendar } = createCheckers(SystemCalendarTI); | ||
const { SystemHours } = createCheckers(SystemHoursTI); | ||
const { SystemInformation } = createCheckers(SystemInformationTI); | ||
const { SystemPricingPlans } = createCheckers(SystemPricingPlansTI); | ||
const { SystemRegions } = createCheckers(SystemRegionsTI); | ||
const { VehicleTypes } = createCheckers(VehicleTypesTI); | ||
|
||
// json test data: these are gbfs with no errors for v2.3 | ||
import freeBikeStatusJson from "../../../testFixtures/v2.3/free_bike_status.json"; | ||
import gbfsVersionsJson from "../../../testFixtures/v2.3/gbfs_versions.json"; | ||
import gbfsJson from "../../../testFixtures/v2.3/gbfs.json"; | ||
import geofencingZonesJson from "../../../testFixtures/v2.3/geofencing_zones.json"; | ||
import stationInformationJson from "../../../testFixtures/v2.3/station_information.json"; | ||
import stationStatusJson from "../../../testFixtures/v2.3/station_status.json"; | ||
import systemAlertsJson from "../../../testFixtures/v2.3/system_alerts.json"; | ||
import systemCalendarJson from "../../../testFixtures/v2.3/system_calendar.json"; | ||
import systemHoursJson from "../../../testFixtures/v2.3/system_hours.json"; | ||
import systemInformationJson from "../../../testFixtures/v2.3/system_information.json"; | ||
import systemPricingPlansJson from "../../../testFixtures/v2.3/system_pricing_plans.json"; | ||
import systemRegionsJson from "../../../testFixtures/v2.3/system_regions.json"; | ||
import vehicleTypesJson from "../../../testFixtures/v2.3/vehicle_types.json"; | ||
|
||
// Date objects cannot be represented in JSON | ||
// Manual checks for dates are required | ||
describe("GBFS Validator v2.3", () => { | ||
it("should check if gbfs_versions is valid", () => { | ||
expect(() => { | ||
GbfsVersions.check(gbfsVersionsJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if gbfs is valid", () => { | ||
expect(() => { | ||
Gbfs.check(gbfsJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if geofencing_zones is valid", () => { | ||
expect(() => { | ||
GeofencingZones.check(geofencingZonesJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if station_information is valid", () => { | ||
expect(() => { | ||
StationInformation.check(stationInformationJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if station_status is valid", () => { | ||
expect(() => { | ||
StationStatus.check(stationStatusJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if system_alerts is valid", () => { | ||
expect(() => { | ||
SystemAlerts.check(systemAlertsJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if system_information is valid", () => { | ||
expect(() => { | ||
SystemCalendar.check(systemCalendarJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if system_information is valid", () => { | ||
expect(() => { | ||
SystemHours.check(systemHoursJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if system_information is valid", () => { | ||
expect(() => { | ||
SystemInformation.check(systemInformationJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if system_pricing_plans is valid", () => { | ||
expect(() => { | ||
SystemPricingPlans.check(systemPricingPlansJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if system_regions is valid", () => { | ||
expect(() => { | ||
SystemRegions.check(systemRegionsJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if vehicle_status is valida", () => { | ||
expect(() => { | ||
FreeBikeStatus.check(freeBikeStatusJson); | ||
}).not.toThrow(); | ||
}); | ||
|
||
it("should check if vehicle_types is valid", () => { | ||
expect(() => { | ||
VehicleTypes.check(vehicleTypesJson); | ||
}).not.toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Exports auto generated files | ||
|
||
export { FreeBikeStatus } from "./free_bike_status"; | ||
export { GbfsVersions } from "./gbfs_versions"; | ||
export { Gbfs } from "./gbfs"; | ||
export { GeofencingZones } from "./geofencing_zones"; | ||
export { StationInformation } from "./station_information"; | ||
export { StationStatus } from "./station_status"; | ||
export { SystemAlerts } from "./system_alerts"; | ||
export { SystemCalendar } from "./system_calendar"; | ||
export { SystemHours } from "./system_hours"; | ||
export { SystemInformation } from "./system_information"; | ||
export { SystemPricingPlans } from "./system_pricing_plans"; | ||
export { SystemRegions } from "./system_regions"; | ||
export { VehicleTypes } from "./vehicle_types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"last_updated": 1606857968, | ||
"ttl": 300, | ||
"version": "2.3", | ||
"data": { | ||
"bikes": [ | ||
{ | ||
"bike_id": "TST:Scooter:1234", | ||
"lat": 59.91465759277344, | ||
"lon": 10.760470390319824, | ||
"is_reserved": false, | ||
"is_disabled": true, | ||
"vehicle_type_id": "TST:VehicleType:Scooter", | ||
"current_range_meters": 1431.2, | ||
"pricing_plan_id": "TST:PricingPlan:Basic", | ||
"rental_uris": { | ||
"android": "test://rentme/TST:Scooter:1234", | ||
"ios": "test://rentme/TST:Scooter:1234", | ||
"web": "https://test.com/rentme/TST:Scooter:1234" | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"last_updated": 1606727710, | ||
"ttl": 300, | ||
"version": "2.3", | ||
"data": { | ||
"en": { | ||
"feeds": [ | ||
{ | ||
"name": "gbfs_versions", | ||
"url": "https://test.com/gbfs_versions" | ||
}, | ||
{ | ||
"name": "system_information", | ||
"url": "https://test.com/system_information" | ||
}, | ||
{ | ||
"name": "vehicle_types", | ||
"url": "https://test.com/vehicle_types" | ||
}, | ||
{ | ||
"name": "station_information", | ||
"url": "https://test.com/station_information" | ||
}, | ||
{ | ||
"name": "station_status", | ||
"url": "https://test.com/station_status" | ||
}, | ||
{ | ||
"name": "free_bike_status", | ||
"url": "https://test.com/free_bike_status" | ||
}, | ||
{ | ||
"name": "system_regions", | ||
"url": "https://test.com/system_regions" | ||
}, | ||
{ | ||
"name": "system_pricing_plans", | ||
"url": "https://test.com/system_pricing_plans" | ||
}, | ||
{ | ||
"name": "system_hours", | ||
"url": "https://test.com/system_hours" | ||
}, | ||
{ | ||
"name": "system_calendar", | ||
"url": "https://test.com/system_calendar" | ||
}, | ||
{ | ||
"name": "system_alerts", | ||
"url": "https://test.com/system_alerts" | ||
}, | ||
{ | ||
"name": "geofencing_zones", | ||
"url": "https://test.com/geofencing_zones" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"last_updated": 1434054678, | ||
"ttl": 0, | ||
"version": "2.3", | ||
"data": { | ||
"versions": [ | ||
{ | ||
"version": "2.2", | ||
"url": "https://test.com/gbfs.json" | ||
} | ||
] | ||
} | ||
} |
Oops, something went wrong.