From 8811ae3ffd51b3613fde846f941ba39d05d4faa1 Mon Sep 17 00:00:00 2001 From: Alessandro Kreslin Date: Mon, 25 May 2026 13:52:22 -0400 Subject: [PATCH] typescript language bindings 3.1-rc3 --- models/typescript/.gitignore | 4 +- models/typescript/README.md | 2 +- models/typescript/package.json | 4 +- .../{v3.1-RC2.spec.ts => v3.1-RC3.spec.ts} | 62 +++++++++++-------- .../{v3.1-RC2 => v3.1-RC3}/index.d.ts | 1 + scripts/generate_typescript_models.sh | 2 +- 6 files changed, 42 insertions(+), 33 deletions(-) rename models/typescript/tests/{v3.1-RC2.spec.ts => v3.1-RC3.spec.ts} (62%) rename models/typescript/{v3.1-RC2 => v3.1-RC3}/index.d.ts (91%) diff --git a/models/typescript/.gitignore b/models/typescript/.gitignore index 1de64094..ab54b59c 100644 --- a/models/typescript/.gitignore +++ b/models/typescript/.gitignore @@ -2,5 +2,5 @@ v2.3/* !v2.3/index.d.ts v3.0/* !v3.0/index.d.ts -v3.1-RC2/* -!v3.1-RC2/index.d.ts +v3.1-RC3/* +!v3.1-RC3/index.d.ts diff --git a/models/typescript/README.md b/models/typescript/README.md index 55d893f8..7e52fdf5 100644 --- a/models/typescript/README.md +++ b/models/typescript/README.md @@ -16,7 +16,7 @@ npm install gbfs-typescript-types --save-dev ## Versions - v2.3 - v3.0 -- v3.1-RC2 +- v3.1-RC3 ## Example Code ```typescript diff --git a/models/typescript/package.json b/models/typescript/package.json index a9ec070d..1de7a265 100644 --- a/models/typescript/package.json +++ b/models/typescript/package.json @@ -1,6 +1,6 @@ { "name": "gbfs-typescript-types", - "version": "1.0.14", + "version": "1.0.15", "description": "Language Bindings for GBFS in Typescript.", "keywords": [ "gbfs", @@ -35,7 +35,7 @@ "index.d.ts", "v2.3", "v3.0", - "v3.1-RC2" + "v3.1-RC3" ], "devDependencies": { "@types/jest": "^29.5.12", diff --git a/models/typescript/tests/v3.1-RC2.spec.ts b/models/typescript/tests/v3.1-RC3.spec.ts similarity index 62% rename from models/typescript/tests/v3.1-RC2.spec.ts rename to models/typescript/tests/v3.1-RC3.spec.ts index 46f48204..2ec68db4 100644 --- a/models/typescript/tests/v3.1-RC2.spec.ts +++ b/models/typescript/tests/v3.1-RC3.spec.ts @@ -1,18 +1,19 @@ import { createCheckers } from "ts-interface-checker"; // checker model -import GbfsVersionsTI from '../v3.1-RC2/test-type-checkers/gbfs_versions-ti'; -import GbfsTI from '../v3.1-RC2/test-type-checkers/gbfs-ti'; -import GeofencingZonesTI from '../v3.1-RC2/test-type-checkers/geofencing_zones-ti'; -import ManifestTI from '../v3.1-RC2/test-type-checkers/manifest-ti'; -import StationsInformationTI from '../v3.1-RC2/test-type-checkers/station_information-ti'; -import StationStatusTI from '../v3.1-RC2/test-type-checkers/station_status-ti'; -import SystemAlertsTI from "../v3.1-RC2/test-type-checkers/system_alerts-ti"; -import SystemInformationTI from '../v3.1-RC2/test-type-checkers/system_information-ti'; -import SystemPricingPlansTI from '../v3.1-RC2/test-type-checkers/system_pricing_plans-ti' -import SystemRegionsTI from "../v3.1-RC2/test-type-checkers/system_regions-ti"; -import VehicleStatusTI from "../v3.1-RC2/test-type-checkers/vehicle_status-ti"; -import VehicleTypesTI from '../v3.1-RC2/test-type-checkers/vehicle_types-ti'; +import GbfsVersionsTI from '../v3.1-RC3/test-type-checkers/gbfs_versions-ti'; +import GbfsTI from '../v3.1-RC3/test-type-checkers/gbfs-ti'; +import GeofencingZonesTI from '../v3.1-RC3/test-type-checkers/geofencing_zones-ti'; +import ManifestTI from '../v3.1-RC3/test-type-checkers/manifest-ti'; +import StationsInformationTI from '../v3.1-RC3/test-type-checkers/station_information-ti'; +import StationStatusTI from '../v3.1-RC3/test-type-checkers/station_status-ti'; +import SystemAlertsTI from "../v3.1-RC3/test-type-checkers/system_alerts-ti"; +import SystemInformationTI from '../v3.1-RC3/test-type-checkers/system_information-ti'; +import SystemPricingPlansTI from '../v3.1-RC3/test-type-checkers/system_pricing_plans-ti' +import SystemRegionsTI from "../v3.1-RC3/test-type-checkers/system_regions-ti"; +import VehicleAvailabilityTI from "../v3.1-RC3/test-type-checkers/vehicle_availability-ti"; +import VehicleStatusTI from "../v3.1-RC3/test-type-checkers/vehicle_status-ti"; +import VehicleTypesTI from '../v3.1-RC3/test-type-checkers/vehicle_types-ti'; // checkers const { GbfsVersions } = createCheckers(GbfsVersionsTI); @@ -25,26 +26,28 @@ const { SystemAlerts } = createCheckers(SystemAlertsTI); const { SystemInformation } = createCheckers(SystemInformationTI); const { SystemPricingPlans } = createCheckers(SystemPricingPlansTI); const { SystemRegions } = createCheckers(SystemRegionsTI); +const { VehicleAvailability } = createCheckers(VehicleAvailabilityTI); const { VehicleStatus } = createCheckers(VehicleStatusTI); const { VehicleTypes } = createCheckers(VehicleTypesTI); -// json test data: these are gbfs with no errors for v3.1-RC2 -import gbfsVersionsJson from '../../../testFixtures/v3.1-RC2/gbfs_versions.json'; -import gbfsJson from '../../../testFixtures/v3.1-RC2/gbfs.json'; -import geofencingZonesJson from '../../../testFixtures/v3.1-RC2/geofencing_zones.json'; -import manifestJson from '../../../testFixtures/v3.1-RC2/manifest.json'; -import stationInformationJson from '../../../testFixtures/v3.1-RC2/station_information.json'; -import stationStatusJson from '../../../testFixtures/v3.1-RC2/station_status.json'; -import systemAlertsJson from '../../../testFixtures/v3.1-RC2/system_alerts.json'; -import systemInformationJson from '../../../testFixtures/v3.1-RC2/system_information.json'; -import systemPricingPlansJson from '../../../testFixtures/v3.1-RC2/system_pricing_plans.json'; -import systemRegionsJson from '../../../testFixtures/v3.1-RC2/system_regions.json'; -import vehicleStatusJson from '../../../testFixtures/v3.1-RC2/vehicle_status.json'; -import vehicleTypesJson from '../../../testFixtures/v3.1-RC2/vehicle_types.json'; +// json test data: these are gbfs with no errors for v3.1-RC3 +import gbfsVersionsJson from '../../../testFixtures/v3.1-RC3/gbfs_versions.json'; +import gbfsJson from '../../../testFixtures/v3.1-RC3/gbfs.json'; +import geofencingZonesJson from '../../../testFixtures/v3.1-RC3/geofencing_zones.json'; +import manifestJson from '../../../testFixtures/v3.1-RC3/manifest.json'; +import stationInformationJson from '../../../testFixtures/v3.1-RC3/station_information.json'; +import stationStatusJson from '../../../testFixtures/v3.1-RC3/station_status.json'; +import systemAlertsJson from '../../../testFixtures/v3.1-RC3/system_alerts.json'; +import systemInformationJson from '../../../testFixtures/v3.1-RC3/system_information.json'; +import systemPricingPlansJson from '../../../testFixtures/v3.1-RC3/system_pricing_plans.json'; +import systemRegionsJson from '../../../testFixtures/v3.1-RC3/system_regions.json'; +import vehicleAvailabilityJson from '../../../testFixtures/v3.1-RC3/vehicle_availability.json'; +import vehicleStatusJson from '../../../testFixtures/v3.1-RC3/vehicle_status.json'; +import vehicleTypesJson from '../../../testFixtures/v3.1-RC3/vehicle_types.json'; // Date objects cannot be represented in JSON // Manual checks for dates are required -describe('GBFS Validator v3.1-RC2', () => { +describe('GBFS Validator v3.1-RC3', () => { it('should check if gbfs_versions is valid', () => { expect(() => { GbfsVersions.check(gbfsVersionsJson); @@ -104,8 +107,13 @@ describe('GBFS Validator v3.1-RC2', () => { SystemRegions.check(systemRegionsJson); }).not.toThrow(); }); + it('should check if vehicle_availability is valid', () => { + expect(() => { + VehicleAvailability.check(vehicleAvailabilityJson); + }).not.toThrow(); + }); - it('should check if vehicle_status is valida', () => { + it('should check if vehicle_status is valid', () => { expect(() => { VehicleStatus.check(vehicleStatusJson); }).not.toThrow(); diff --git a/models/typescript/v3.1-RC2/index.d.ts b/models/typescript/v3.1-RC3/index.d.ts similarity index 91% rename from models/typescript/v3.1-RC2/index.d.ts rename to models/typescript/v3.1-RC3/index.d.ts index b9cef0f4..c364e2e0 100644 --- a/models/typescript/v3.1-RC2/index.d.ts +++ b/models/typescript/v3.1-RC3/index.d.ts @@ -10,5 +10,6 @@ export { SystemAlerts } from './system_alerts'; export { SystemInformation } from './system_information'; export { SystemPricingPlans } from './system_pricing_plans'; export { SystemRegions } from './system_regions'; +export { VehicleAvailability } from './vehicle_availability'; export { VehicleStatus } from './vehicle_status'; export { VehicleTypes } from './vehicle_types'; diff --git a/scripts/generate_typescript_models.sh b/scripts/generate_typescript_models.sh index 11694a08..4af670b2 100755 --- a/scripts/generate_typescript_models.sh +++ b/scripts/generate_typescript_models.sh @@ -10,7 +10,7 @@ gbfs_version="v$1" #$1 is the first argument passed to the script (the version n parent_dir="$(dirname "$(dirname "$0")")" copyright_file="$parent_dir/copyright.txt" -gbfs_versions=("v2.3" "v3.0" "v3.1-RC2") +gbfs_versions=("v2.3" "v3.0" "v3.1-RC3") for gbfs_version in "${gbfs_versions[@]}"; do echo "gbfs_version: $gbfs_version"