Skip to content

Commit ac297b8

Browse files
authored
fix: Corrected the data_type property examples in the OpenApi schemas (#1183)
1 parent 8a19a7e commit ac297b8

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

.github/workflows/typescript-generator-check.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Verify TypeScript Types Generation
22
on:
33
pull_request:
44
branches:
5-
- main
5+
- main
66
paths:
77
- "docs/DatabaseCatalogAPI.yaml"
88

@@ -45,6 +45,12 @@ jobs:
4545
env:
4646
OUTPUT_PATH_TYPES: src/app/services/feeds/generated/types.ts
4747

48+
- name: Upload generated types
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: generated_types.ts
52+
path: web-app/src/app/services/feeds/generated/types.ts
53+
4854
- name: Compare TypeScript types with existing types
4955
working-directory: web-app
5056
run: diff src/app/services/feeds/generated/types.ts src/app/services/feeds/types.ts || (echo "Types are different!" && exit 1)

docs/DatabaseCatalogAPI.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,6 @@ components:
433433
- development
434434
- future
435435
example: deprecated
436-
# Have to put the enum inline because of a bug in openapi-generator
437-
# $ref: "#/components/schemas/FeedStatus"
438436
official:
439437
description: >
440438
A boolean value indicating if the feed is official or not.
@@ -462,6 +460,14 @@ components:
462460
- $ref: "#/components/schemas/Feed"
463461
- type: object
464462
properties:
463+
# We reproduce this property here so we can have a specific example.
464+
data_type:
465+
type: string
466+
enum:
467+
- gtfs
468+
- gtfs_rt
469+
- gbfs
470+
example: gtfs
465471
locations:
466472
$ref: "#/components/schemas/Locations"
467473
latest_dataset:
@@ -472,6 +478,14 @@ components:
472478
- $ref: "#/components/schemas/BasicFeed"
473479
- type: object
474480
properties:
481+
# We reproduce this property here so we can have a specific example.
482+
data_type:
483+
type: string
484+
enum:
485+
- gtfs
486+
- gtfs_rt
487+
- gbfs
488+
example: gbfs
475489
locations:
476490
$ref: "#/components/schemas/Locations"
477491
system_id:
@@ -590,6 +604,14 @@ components:
590604
- $ref: "#/components/schemas/Feed"
591605
- type: object
592606
properties:
607+
# We reproduce this property here so we can have a specific example.
608+
data_type:
609+
type: string
610+
enum:
611+
- gtfs
612+
- gtfs_rt
613+
- gbfs
614+
example: gtfs_rt
593615
entity_types:
594616
type: array
595617
items:

web-app/src/app/services/feeds/types.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,20 @@ export interface components {
190190
note?: string;
191191
};
192192
GtfsFeed: components['schemas']['Feed'] & {
193+
/**
194+
* @example gtfs
195+
* @enum {string}
196+
*/
197+
data_type?: 'gtfs' | 'gtfs_rt' | 'gbfs';
193198
locations?: components['schemas']['Locations'];
194199
latest_dataset?: components['schemas']['LatestDataset'];
195200
};
196201
GbfsFeed: components['schemas']['BasicFeed'] & {
202+
/**
203+
* @example gbfs
204+
* @enum {string}
205+
*/
206+
data_type?: 'gtfs' | 'gtfs_rt' | 'gbfs';
197207
locations?: components['schemas']['Locations'];
198208
/**
199209
* @description The system ID of the feed. This is a unique identifier for the system that the feed belongs to.
@@ -296,6 +306,11 @@ export interface components {
296306
};
297307
GbfsFeeds: Array<components['schemas']['GbfsFeed']>;
298308
GtfsRTFeed: components['schemas']['Feed'] & {
309+
/**
310+
* @example gtfs_rt
311+
* @enum {string}
312+
*/
313+
data_type?: 'gtfs' | 'gtfs_rt' | 'gbfs';
299314
entity_types?: Array<'vp' | 'tu' | 'sa'>;
300315
/** @description A list of the GTFS feeds that the real time source is associated with, represented by their MDB source IDs. */
301316
feed_references?: string[];

0 commit comments

Comments
 (0)