@tmlmobilidade/go-types-gtfs-validator 20260828.1636.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clean/gtfs-validation.d.ts +635 -0
- package/dist/clean/gtfs-validation.js +19 -0
- package/dist/clean/message.d.ts +24 -0
- package/dist/clean/message.js +12 -0
- package/dist/clean/rule.d.ts +50 -0
- package/dist/clean/rule.js +20 -0
- package/dist/clean/summary.d.ts +50 -0
- package/dist/clean/summary.js +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/output/index.d.ts +2 -0
- package/dist/output/index.js +2 -0
- package/dist/output/message.d.ts +24 -0
- package/dist/output/message.js +12 -0
- package/dist/output/summary.d.ts +50 -0
- package/dist/output/summary.js +9 -0
- package/dist/rule-types.d.ts +1 -0
- package/dist/rule-types.js +295 -0
- package/dist/rules/compare.d.ts +14 -0
- package/dist/rules/compare.js +9 -0
- package/dist/rules/index.d.ts +3 -0
- package/dist/rules/index.js +3 -0
- package/dist/rules/rule.d.ts +37 -0
- package/dist/rules/rule.js +14 -0
- package/dist/rules/rules-config.d.ts +2 -0
- package/dist/rules/rules-config.js +595 -0
- package/dist/rules.d.ts +2 -0
- package/dist/rules.js +594 -0
- package/package.json +50 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a comparison entry for a GTFS validaton rule.
|
|
4
|
+
*/
|
|
5
|
+
export declare const GtfsValidationRuleCompareSchema: z.ZodObject<{
|
|
6
|
+
key: z.ZodString;
|
|
7
|
+
value: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
value: string;
|
|
10
|
+
key: string;
|
|
11
|
+
}, {
|
|
12
|
+
value: string;
|
|
13
|
+
key: string;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Represents a GTFS validator rule.
|
|
17
|
+
* @see https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#211-rules
|
|
18
|
+
*/
|
|
19
|
+
export declare const GtfsValidationRuleSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
20
|
+
compare: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
21
|
+
key: z.ZodString;
|
|
22
|
+
value: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
value: string;
|
|
25
|
+
key: string;
|
|
26
|
+
}, {
|
|
27
|
+
value: string;
|
|
28
|
+
key: string;
|
|
29
|
+
}>, "many">>>;
|
|
30
|
+
depends_on: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
31
|
+
options: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
32
|
+
severity: z.ZodEnum<["ignore", "info", "warning", "error", "forbidden"]>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
35
|
+
options?: string[] | undefined;
|
|
36
|
+
compare?: {
|
|
37
|
+
value: string;
|
|
38
|
+
key: string;
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
depends_on?: string[] | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
43
|
+
options?: string[] | undefined;
|
|
44
|
+
compare?: {
|
|
45
|
+
value: string;
|
|
46
|
+
key: string;
|
|
47
|
+
}[] | undefined;
|
|
48
|
+
depends_on?: string[] | undefined;
|
|
49
|
+
}>>;
|
|
50
|
+
export type GtfsValidationRule = z.infer<typeof GtfsValidationRuleSchema>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { SeverityStatusSchema } from '@tmlmobilidade/go-types-shared';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a comparison entry for a GTFS validaton rule.
|
|
6
|
+
*/
|
|
7
|
+
export const GtfsValidationRuleCompareSchema = z.object({
|
|
8
|
+
key: z.string(),
|
|
9
|
+
value: z.string(),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Represents a GTFS validator rule.
|
|
13
|
+
* @see https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#211-rules
|
|
14
|
+
*/
|
|
15
|
+
export const GtfsValidationRuleSchema = z.record(z.string(), z.object({
|
|
16
|
+
compare: z.array(GtfsValidationRuleCompareSchema).default([]).optional(),
|
|
17
|
+
depends_on: z.array(z.string()).default([]).optional(),
|
|
18
|
+
options: z.array(z.string()).default([]).optional(),
|
|
19
|
+
severity: SeverityStatusSchema,
|
|
20
|
+
}));
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GtfsValidationSummarySchema: z.ZodObject<{
|
|
3
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
4
|
+
field: z.ZodString;
|
|
5
|
+
file_name: z.ZodString;
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
rows: z.ZodArray<z.ZodNumber, "many">;
|
|
8
|
+
rule_id: z.ZodString;
|
|
9
|
+
severity: z.ZodEnum<["ignore", "info", "warning", "error", "forbidden"]>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
field: string;
|
|
12
|
+
file_name: string;
|
|
13
|
+
message: string;
|
|
14
|
+
rows: number[];
|
|
15
|
+
rule_id: string;
|
|
16
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
17
|
+
}, {
|
|
18
|
+
field: string;
|
|
19
|
+
file_name: string;
|
|
20
|
+
message: string;
|
|
21
|
+
rows: number[];
|
|
22
|
+
rule_id: string;
|
|
23
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
24
|
+
}>, "many">;
|
|
25
|
+
total_errors: z.ZodNumber;
|
|
26
|
+
total_warnings: z.ZodNumber;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
messages: {
|
|
29
|
+
field: string;
|
|
30
|
+
file_name: string;
|
|
31
|
+
message: string;
|
|
32
|
+
rows: number[];
|
|
33
|
+
rule_id: string;
|
|
34
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
35
|
+
}[];
|
|
36
|
+
total_errors: number;
|
|
37
|
+
total_warnings: number;
|
|
38
|
+
}, {
|
|
39
|
+
messages: {
|
|
40
|
+
field: string;
|
|
41
|
+
file_name: string;
|
|
42
|
+
message: string;
|
|
43
|
+
rows: number[];
|
|
44
|
+
rule_id: string;
|
|
45
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
46
|
+
}[];
|
|
47
|
+
total_errors: number;
|
|
48
|
+
total_warnings: number;
|
|
49
|
+
}>;
|
|
50
|
+
export type GtfsValidationSummary = z.infer<typeof GtfsValidationSummarySchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { GtfsValidationMessageSchema } from './message.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/* * */
|
|
5
|
+
export const GtfsValidationSummarySchema = z.object({
|
|
6
|
+
messages: z.array(GtfsValidationMessageSchema),
|
|
7
|
+
total_errors: z.number(),
|
|
8
|
+
total_warnings: z.number(),
|
|
9
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GtfsValidationOutputMessageSchema: z.ZodObject<{
|
|
3
|
+
field: z.ZodString;
|
|
4
|
+
file_name: z.ZodString;
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
rows: z.ZodArray<z.ZodNumber, "many">;
|
|
7
|
+
rule_id: z.ZodString;
|
|
8
|
+
severity: z.ZodEnum<["ignore", "info", "warning", "error", "forbidden"]>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
field: string;
|
|
11
|
+
file_name: string;
|
|
12
|
+
message: string;
|
|
13
|
+
rows: number[];
|
|
14
|
+
rule_id: string;
|
|
15
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
16
|
+
}, {
|
|
17
|
+
field: string;
|
|
18
|
+
file_name: string;
|
|
19
|
+
message: string;
|
|
20
|
+
rows: number[];
|
|
21
|
+
rule_id: string;
|
|
22
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
23
|
+
}>;
|
|
24
|
+
export type GtfsValidationOutputMessage = z.infer<typeof GtfsValidationOutputMessageSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { SeverityStatusSchema } from '@tmlmobilidade/go-types-shared';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/* * */
|
|
5
|
+
export const GtfsValidationOutputMessageSchema = z.object({
|
|
6
|
+
field: z.string(),
|
|
7
|
+
file_name: z.string(),
|
|
8
|
+
message: z.string(),
|
|
9
|
+
rows: z.array(z.number()),
|
|
10
|
+
rule_id: z.string(),
|
|
11
|
+
severity: SeverityStatusSchema,
|
|
12
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GtfsValidationOutputSummarySchema: z.ZodObject<{
|
|
3
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
4
|
+
field: z.ZodString;
|
|
5
|
+
file_name: z.ZodString;
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
rows: z.ZodArray<z.ZodNumber, "many">;
|
|
8
|
+
rule_id: z.ZodString;
|
|
9
|
+
severity: z.ZodEnum<["ignore", "info", "warning", "error", "forbidden"]>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
field: string;
|
|
12
|
+
file_name: string;
|
|
13
|
+
message: string;
|
|
14
|
+
rows: number[];
|
|
15
|
+
rule_id: string;
|
|
16
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
17
|
+
}, {
|
|
18
|
+
field: string;
|
|
19
|
+
file_name: string;
|
|
20
|
+
message: string;
|
|
21
|
+
rows: number[];
|
|
22
|
+
rule_id: string;
|
|
23
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
24
|
+
}>, "many">;
|
|
25
|
+
total_errors: z.ZodNumber;
|
|
26
|
+
total_warnings: z.ZodNumber;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
messages: {
|
|
29
|
+
field: string;
|
|
30
|
+
file_name: string;
|
|
31
|
+
message: string;
|
|
32
|
+
rows: number[];
|
|
33
|
+
rule_id: string;
|
|
34
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
35
|
+
}[];
|
|
36
|
+
total_errors: number;
|
|
37
|
+
total_warnings: number;
|
|
38
|
+
}, {
|
|
39
|
+
messages: {
|
|
40
|
+
field: string;
|
|
41
|
+
file_name: string;
|
|
42
|
+
message: string;
|
|
43
|
+
rows: number[];
|
|
44
|
+
rule_id: string;
|
|
45
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
46
|
+
}[];
|
|
47
|
+
total_errors: number;
|
|
48
|
+
total_warnings: number;
|
|
49
|
+
}>;
|
|
50
|
+
export type GtfsValidationOutputSummary = z.infer<typeof GtfsValidationOutputSummarySchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { GtfsValidationOutputMessageSchema } from './message.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/* * */
|
|
5
|
+
export const GtfsValidationOutputSummarySchema = z.object({
|
|
6
|
+
messages: z.array(GtfsValidationOutputMessageSchema),
|
|
7
|
+
total_errors: z.number(),
|
|
8
|
+
total_warnings: z.number(),
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
// import { type RuleConfig, type WithCompare, type WithOptions } from '@/gtfs-rules/rules-info.js';
|
|
2
|
+
// import { type SeverityLevel } from '@/gtfs-validation/severity-level.js';
|
|
3
|
+
export {};
|
|
4
|
+
// export interface GtfsRulesTypes {
|
|
5
|
+
// agency: {
|
|
6
|
+
// _file: SeverityLevel
|
|
7
|
+
// agency_email_valid_address: RuleConfig
|
|
8
|
+
// agency_fare_url_valid_url: RuleConfig
|
|
9
|
+
// agency_id_matched_with_agency_name: WithCompare<RuleConfig>
|
|
10
|
+
// agency_id_unique: WithOptions<RuleConfig>
|
|
11
|
+
// agency_lang_valid_language_tag: RuleConfig
|
|
12
|
+
// agency_name_present: WithOptions<RuleConfig>
|
|
13
|
+
// agency_phone_valid_phone_number: RuleConfig
|
|
14
|
+
// agency_timezone_valid_id: RuleConfig
|
|
15
|
+
// agency_url_valid_url: RuleConfig
|
|
16
|
+
// }
|
|
17
|
+
// attributions: {
|
|
18
|
+
// _file: SeverityLevel
|
|
19
|
+
// agency_id: RuleConfig
|
|
20
|
+
// attribution_email: RuleConfig
|
|
21
|
+
// attribution_id: RuleConfig
|
|
22
|
+
// attribution_phone: RuleConfig
|
|
23
|
+
// attribution_url: RuleConfig
|
|
24
|
+
// is_authority: RuleConfig
|
|
25
|
+
// is_operator: RuleConfig
|
|
26
|
+
// is_producer: RuleConfig
|
|
27
|
+
// organization_name: RuleConfig
|
|
28
|
+
// route_id: RuleConfig
|
|
29
|
+
// trip_id: RuleConfig
|
|
30
|
+
// }
|
|
31
|
+
// calendar: {
|
|
32
|
+
// _file: SeverityLevel
|
|
33
|
+
// calendar_end_date_valid_yyyymmdd: RuleConfig
|
|
34
|
+
// calendar_service_id_unique_non_empty: RuleConfig
|
|
35
|
+
// calendar_start_date_valid_yyyymmdd: RuleConfig
|
|
36
|
+
// friday: RuleConfig
|
|
37
|
+
// monday: RuleConfig
|
|
38
|
+
// saturday: RuleConfig
|
|
39
|
+
// sunday: RuleConfig
|
|
40
|
+
// thursday: RuleConfig
|
|
41
|
+
// tuesday: RuleConfig
|
|
42
|
+
// wednesday: RuleConfig
|
|
43
|
+
// }
|
|
44
|
+
// calendar_dates: {
|
|
45
|
+
// _file: SeverityLevel
|
|
46
|
+
// calendar_dates_service_id_references_calendar: RuleConfig
|
|
47
|
+
// day_type: WithOptions<RuleConfig>
|
|
48
|
+
// exception_date_valid_yyyymmdd: RuleConfig
|
|
49
|
+
// exception_type_add_or_remove_service: RuleConfig
|
|
50
|
+
// holiday: WithOptions<RuleConfig>
|
|
51
|
+
// period: WithOptions<RuleConfig>
|
|
52
|
+
// }
|
|
53
|
+
// fare_attributes: {
|
|
54
|
+
// _file: SeverityLevel
|
|
55
|
+
// currency_type_valid: WithOptions<RuleConfig>
|
|
56
|
+
// fare_attributes_agency_id_references_agency_table: RuleConfig
|
|
57
|
+
// fare_id_unique: RuleConfig
|
|
58
|
+
// fare_price_valid_non_negative_decimal: RuleConfig
|
|
59
|
+
// payment_method_valid_gtfs_enum: WithOptions<RuleConfig>
|
|
60
|
+
// transfer_duration_valid_seconds_range: RuleConfig
|
|
61
|
+
// transfers_valid_gtfs_enum: WithOptions<RuleConfig>
|
|
62
|
+
// }
|
|
63
|
+
// fare_media: {
|
|
64
|
+
// _file: SeverityLevel
|
|
65
|
+
// fare_media_id_unique: RuleConfig
|
|
66
|
+
// fare_media_name_non_empty: RuleConfig
|
|
67
|
+
// fare_media_type_valid: WithOptions<RuleConfig>
|
|
68
|
+
// }
|
|
69
|
+
// fare_rules: {
|
|
70
|
+
// _file: SeverityLevel
|
|
71
|
+
// fare_rule_contains_id_references_zones_stops: RuleConfig
|
|
72
|
+
// fare_rule_destination_id_references_zones_stops: RuleConfig
|
|
73
|
+
// fare_rule_fare_id_references_fare_attributes: RuleConfig
|
|
74
|
+
// fare_rule_origin_id_references_zones_stops: RuleConfig
|
|
75
|
+
// fare_rule_route_id_references_routes: RuleConfig
|
|
76
|
+
// }
|
|
77
|
+
// feed_info: {
|
|
78
|
+
// _file: SeverityLevel
|
|
79
|
+
// default_lang_matches_feed_lang_when_present: RuleConfig
|
|
80
|
+
// feed_contact_email_valid_address: RuleConfig
|
|
81
|
+
// feed_contact_url_valid_http_url: RuleConfig
|
|
82
|
+
// feed_end_date_valid_yyyymmdd_not_before_start: RuleConfig
|
|
83
|
+
// feed_lang_valid_tag: WithOptions<RuleConfig>
|
|
84
|
+
// feed_publisher_name_non_empty: RuleConfig
|
|
85
|
+
// feed_publisher_url_valid_http_url: RuleConfig
|
|
86
|
+
// feed_remarks: RuleConfig
|
|
87
|
+
// feed_start_date_valid_yyyymmdd: RuleConfig
|
|
88
|
+
// feed_type: WithOptions<RuleConfig>
|
|
89
|
+
// feed_version_valid_identifier: RuleConfig
|
|
90
|
+
// }
|
|
91
|
+
// file_validation: {
|
|
92
|
+
// _file: SeverityLevel
|
|
93
|
+
// gtfs_feed_file_presence_and_integrity_rule: RuleConfig
|
|
94
|
+
// }
|
|
95
|
+
// frequencies: {
|
|
96
|
+
// _file: SeverityLevel
|
|
97
|
+
// exact_times_zero_when_timed_trip_uses_frequencies: RuleConfig
|
|
98
|
+
// frequencies_trip_id_references_trips_table: RuleConfig
|
|
99
|
+
// frequency_end_time_valid: RuleConfig
|
|
100
|
+
// frequency_start_time_valid: RuleConfig
|
|
101
|
+
// headway_secs_positive_and_aligns_trip: RuleConfig
|
|
102
|
+
// }
|
|
103
|
+
// levels: {
|
|
104
|
+
// _file: SeverityLevel
|
|
105
|
+
// level_id: RuleConfig
|
|
106
|
+
// level_index: RuleConfig
|
|
107
|
+
// level_name: RuleConfig
|
|
108
|
+
// }
|
|
109
|
+
// pathways: {
|
|
110
|
+
// _file: SeverityLevel
|
|
111
|
+
// from_stop_id: RuleConfig
|
|
112
|
+
// is_bidirectional: RuleConfig
|
|
113
|
+
// length: RuleConfig
|
|
114
|
+
// max_slope: RuleConfig
|
|
115
|
+
// min_width: RuleConfig
|
|
116
|
+
// pathway_id: RuleConfig
|
|
117
|
+
// pathway_mode: RuleConfig
|
|
118
|
+
// reversed_signposted_as: RuleConfig
|
|
119
|
+
// signposted_as: RuleConfig
|
|
120
|
+
// stair_count: RuleConfig
|
|
121
|
+
// to_stop_id: RuleConfig
|
|
122
|
+
// traversal_time: RuleConfig
|
|
123
|
+
// }
|
|
124
|
+
// rider_categories: {
|
|
125
|
+
// _file: SeverityLevel
|
|
126
|
+
// at_most_one_default_fare_category: RuleConfig
|
|
127
|
+
// eligibility_url_valid_http_url: RuleConfig
|
|
128
|
+
// rider_category_id_unique: RuleConfig
|
|
129
|
+
// rider_category_name_non_empty: RuleConfig
|
|
130
|
+
// }
|
|
131
|
+
// routes: {
|
|
132
|
+
// _file: SeverityLevel
|
|
133
|
+
// circular: WithOptions<RuleConfig>
|
|
134
|
+
// continuous_drop_off_valid_gtfs_enum: WithOptions<RuleConfig>
|
|
135
|
+
// continuous_pickup_valid_gtfs_enum: WithOptions<RuleConfig>
|
|
136
|
+
// line_id: RuleConfig
|
|
137
|
+
// line_long_name: RuleConfig
|
|
138
|
+
// line_short_name: RuleConfig
|
|
139
|
+
// network_id_references_networks_table: RuleConfig
|
|
140
|
+
// path_type_valid_enum: WithOptions<RuleConfig>
|
|
141
|
+
// route_agency_id_references_agency_table: RuleConfig
|
|
142
|
+
// route_color_valid_hex_string: RuleConfig
|
|
143
|
+
// route_desc_per_severity_and_content_rules: RuleConfig
|
|
144
|
+
// route_id_unique: RuleConfig
|
|
145
|
+
// route_long_name_or_short_name_present: RuleConfig
|
|
146
|
+
// route_remarks: RuleConfig
|
|
147
|
+
// route_short_name_or_long_name_present: RuleConfig
|
|
148
|
+
// route_sort_order_non_negative_integer: RuleConfig
|
|
149
|
+
// route_text_color_valid_hex_contrast: RuleConfig
|
|
150
|
+
// route_type_valid_gtfs_enum: WithOptions<RuleConfig>
|
|
151
|
+
// route_url_valid_http_url: RuleConfig
|
|
152
|
+
// school: WithOptions<RuleConfig>
|
|
153
|
+
// }
|
|
154
|
+
// shapes: {
|
|
155
|
+
// _file: SeverityLevel
|
|
156
|
+
// shape_block_distance_rows_aggregated: WithOptions<RuleConfig>
|
|
157
|
+
// shape_dist_traveled_delta_mismatches_haversine_block: WithOptions<RuleConfig>
|
|
158
|
+
// shape_dist_traveled_delta_mismatches_haversine_segment: WithOptions<RuleConfig>
|
|
159
|
+
// shape_dist_traveled_non_decreasing_with_sequence: RuleConfig
|
|
160
|
+
// shape_dist_traveled_non_negative_monotonic: RuleConfig
|
|
161
|
+
// shape_id_and_point_sequence_required: RuleConfig
|
|
162
|
+
// shape_id_required: RuleConfig
|
|
163
|
+
// shape_pt_lat_valid_latitude: RuleConfig
|
|
164
|
+
// shape_pt_lon_valid_longitude: RuleConfig
|
|
165
|
+
// shape_pt_sequence_not_repeated_within_shape: RuleConfig
|
|
166
|
+
// shape_pt_sequence_strictly_increasing: RuleConfig
|
|
167
|
+
// shape_sequence_position_mismatches_cumulative_traveled_distance: RuleConfig
|
|
168
|
+
// }
|
|
169
|
+
// stop_times: {
|
|
170
|
+
// _file: SeverityLevel
|
|
171
|
+
// arrival_time_ordering_with_departure_and_frequencies: RuleConfig
|
|
172
|
+
// departure_time_ordering_with_arrival_and_timepoint: RuleConfig
|
|
173
|
+
// drop_off_booking_rule_id_references_booking_rules_or_empty: RuleConfig
|
|
174
|
+
// drop_off_type_valid_gtfs_enum: RuleConfig
|
|
175
|
+
// end_pickup_drop_off_window_valid: RuleConfig
|
|
176
|
+
// location_group_id_consistent_with_trip_id_and_stops: RuleConfig
|
|
177
|
+
// pickup_booking_rule_id_references_booking_rules: RuleConfig
|
|
178
|
+
// pickup_type_valid_gtfs_enum: RuleConfig
|
|
179
|
+
// start_pickup_drop_off_window_valid: RuleConfig
|
|
180
|
+
// stop_headsign_present: RuleConfig
|
|
181
|
+
// stop_times_continuous_drop_off_valid_gtfs_enum: RuleConfig
|
|
182
|
+
// stop_times_continuous_pickup_valid_gtfs_enum: RuleConfig
|
|
183
|
+
// stop_times_shape_dist_traveled_non_decreasing_on_trip: RuleConfig
|
|
184
|
+
// stop_times_stop_id_references_stops_table: RuleConfig
|
|
185
|
+
// stop_times_trip_id_references_trips_table: RuleConfig
|
|
186
|
+
// timepoint_valid_gtfs_enum: RuleConfig
|
|
187
|
+
// }
|
|
188
|
+
// stops: {
|
|
189
|
+
// _file: SeverityLevel
|
|
190
|
+
// has_bench_valid_enum: WithOptions<RuleConfig>
|
|
191
|
+
// has_network_map_valid_enum: WithOptions<RuleConfig>
|
|
192
|
+
// has_pip_real_time_valid_enum: WithOptions<RuleConfig>
|
|
193
|
+
// has_schedules_valid_enum: WithOptions<RuleConfig>
|
|
194
|
+
// has_shelter_valid_enum: WithOptions<RuleConfig>
|
|
195
|
+
// has_stop_sign_valid_enum: WithOptions<RuleConfig>
|
|
196
|
+
// has_tariffs_information_valid_enum: RuleConfig
|
|
197
|
+
// level_id_valid_id: RuleConfig
|
|
198
|
+
// location_type_valid_enum: RuleConfig
|
|
199
|
+
// municipality_id_valid: WithOptions<RuleConfig>
|
|
200
|
+
// parent_station_id_valid_for_stop_hierarchy: RuleConfig
|
|
201
|
+
// parish_id_valid: RuleConfig
|
|
202
|
+
// platform_code_valid: RuleConfig
|
|
203
|
+
// public_visible_valid_enum: RuleConfig
|
|
204
|
+
// region_id_valid: WithOptions<RuleConfig>
|
|
205
|
+
// shelter_code_valid: RuleConfig
|
|
206
|
+
// shelter_maintainer_valid: RuleConfig
|
|
207
|
+
// stop_code_valid: RuleConfig
|
|
208
|
+
// stop_desc_valid: RuleConfig
|
|
209
|
+
// stop_id_unique: RuleConfig
|
|
210
|
+
// stop_lat_valid_latitude_range: RuleConfig
|
|
211
|
+
// stop_lon_valid_longitude_range: RuleConfig
|
|
212
|
+
// stop_name_required_by_location_type: RuleConfig
|
|
213
|
+
// stop_short_name_valid: RuleConfig
|
|
214
|
+
// stop_timezone_valid: RuleConfig
|
|
215
|
+
// stop_url_valid_url: RuleConfig
|
|
216
|
+
// tts_stop_name_valid: RuleConfig
|
|
217
|
+
// wheelchair_boarding_valid_enum: WithOptions<RuleConfig>
|
|
218
|
+
// zone_id_valid: RuleConfig
|
|
219
|
+
// }
|
|
220
|
+
// transfers: {
|
|
221
|
+
// _file: SeverityLevel
|
|
222
|
+
// from_stop_id: RuleConfig
|
|
223
|
+
// min_transfer_time: RuleConfig
|
|
224
|
+
// to_stop_id: RuleConfig
|
|
225
|
+
// transfer_type: RuleConfig
|
|
226
|
+
// }
|
|
227
|
+
// translations: {
|
|
228
|
+
// _file: SeverityLevel
|
|
229
|
+
// field_name: RuleConfig
|
|
230
|
+
// field_value: RuleConfig
|
|
231
|
+
// language: RuleConfig
|
|
232
|
+
// record_id: RuleConfig
|
|
233
|
+
// record_sub_id: RuleConfig
|
|
234
|
+
// table_name: RuleConfig
|
|
235
|
+
// translation: RuleConfig
|
|
236
|
+
// }
|
|
237
|
+
// trips: {
|
|
238
|
+
// _file: SeverityLevel
|
|
239
|
+
// bikes_allowed_valid_gtfs_enum: RuleConfig
|
|
240
|
+
// block_id_in_allowed_set: RuleConfig
|
|
241
|
+
// direction_id_consistent_for_all_patterns_in_trips: RuleConfig
|
|
242
|
+
// direction_id_matches_feed_pattern_direction: RuleConfig
|
|
243
|
+
// direction_id_valid_enum: RuleConfig
|
|
244
|
+
// one_pattern_id_per_shape_id_group: RuleConfig
|
|
245
|
+
// one_shape_id_per_pattern_id_group: RuleConfig
|
|
246
|
+
// pattern_id_matches_feed_pattern_id_syntax: WithOptions<RuleConfig>
|
|
247
|
+
// pattern_id_present_and_references_consistent: RuleConfig
|
|
248
|
+
// pattern_id_single_trip_signature_per_pattern: RuleConfig
|
|
249
|
+
// pattern_id_trip_has_required_fields_for_grouping: RuleConfig
|
|
250
|
+
// route_id_consistent_for_all_patterns_in_trips: RuleConfig
|
|
251
|
+
// route_id_references_routes_table: RuleConfig
|
|
252
|
+
// service_id_references_calendar_service: RuleConfig
|
|
253
|
+
// shape_id_needs_to_be_the_same_as_pattern_id: RuleConfig
|
|
254
|
+
// shape_id_references_shapes_table_when_present: RuleConfig
|
|
255
|
+
// stop_sequence_increasing_by_one_along_trip: RuleConfig
|
|
256
|
+
// trip_headsign_consistent_for_all_patterns_in_trips: RuleConfig
|
|
257
|
+
// trip_headsign_present_when_short_name_absent: RuleConfig
|
|
258
|
+
// trip_id_limit_max_length: RuleConfig
|
|
259
|
+
// trip_id_unique: RuleConfig
|
|
260
|
+
// trip_path_stop_coordinates_referenced_from_stops: RuleConfig
|
|
261
|
+
// trip_short_name_exclusivity: RuleConfig
|
|
262
|
+
// wheelchair_accessible_valid_gtfs_enum: RuleConfig
|
|
263
|
+
// }
|
|
264
|
+
// vehicles: {
|
|
265
|
+
// _file: SeverityLevel
|
|
266
|
+
// available_seats_non_negative: RuleConfig
|
|
267
|
+
// available_standing_non_negative: RuleConfig
|
|
268
|
+
// bicycles_rack_count_non_negative: WithOptions<RuleConfig>
|
|
269
|
+
// climatization_valid_enum: WithOptions<RuleConfig>
|
|
270
|
+
// consumption_meter_valid_format: WithOptions<RuleConfig>
|
|
271
|
+
// emission_code_valid_for_propulsion_type: WithOptions<RuleConfig>
|
|
272
|
+
// external_sound_valid_enum: WithOptions<RuleConfig>
|
|
273
|
+
// front_display_valid_enum: WithOptions<RuleConfig>
|
|
274
|
+
// internal_sound_level_valid_enum: WithOptions<RuleConfig>
|
|
275
|
+
// kneeling_valid_enum: WithOptions<RuleConfig>
|
|
276
|
+
// license_plate_format_per_market_rules: RuleConfig
|
|
277
|
+
// lowered_floor_valid_enum: WithOptions<RuleConfig>
|
|
278
|
+
// onboard_monitor_valid_enum: WithOptions<RuleConfig>
|
|
279
|
+
// passenger_counting_valid_enum: WithOptions<RuleConfig>
|
|
280
|
+
// propulsion_type_valid_enum: WithOptions<RuleConfig>
|
|
281
|
+
// ramp_valid_enum: WithOptions<RuleConfig>
|
|
282
|
+
// rear_display_valid_enum: WithOptions<RuleConfig>
|
|
283
|
+
// registration_date_valid_day_granularity: RuleConfig
|
|
284
|
+
// side_display_valid_enum: WithOptions<RuleConfig>
|
|
285
|
+
// static_information_valid_enum: WithOptions<RuleConfig>
|
|
286
|
+
// typology_in_allowed_vehicle_types: WithOptions<RuleConfig>
|
|
287
|
+
// vehicle_agency_id_references_agency_table: RuleConfig
|
|
288
|
+
// vehicle_id_unique: RuleConfig
|
|
289
|
+
// vehicle_make_required: RuleConfig
|
|
290
|
+
// vehicle_model_required: RuleConfig
|
|
291
|
+
// vehicle_owner_required: RuleConfig
|
|
292
|
+
// video_surveillance_valid_enum: WithOptions<RuleConfig>
|
|
293
|
+
// wheelchair_spots_valid_enum: WithOptions<RuleConfig>
|
|
294
|
+
// }
|
|
295
|
+
// };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a comparison entry for a GTFS validaton rule.
|
|
4
|
+
*/
|
|
5
|
+
export declare const GtfsValidationRuleCompareSchema: z.ZodObject<{
|
|
6
|
+
key: z.ZodString;
|
|
7
|
+
value: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
value: string;
|
|
10
|
+
key: string;
|
|
11
|
+
}, {
|
|
12
|
+
value: string;
|
|
13
|
+
key: string;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a GTFS validator rule.
|
|
4
|
+
* @see https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#211-rules
|
|
5
|
+
*/
|
|
6
|
+
export declare const GtfsValidationRuleSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
7
|
+
compare: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
8
|
+
key: z.ZodString;
|
|
9
|
+
value: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
value: string;
|
|
12
|
+
key: string;
|
|
13
|
+
}, {
|
|
14
|
+
value: string;
|
|
15
|
+
key: string;
|
|
16
|
+
}>, "many">>>;
|
|
17
|
+
depends_on: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
18
|
+
options: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
19
|
+
severity: z.ZodEnum<["ignore", "info", "warning", "error", "forbidden"]>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
22
|
+
options?: string[] | undefined;
|
|
23
|
+
compare?: {
|
|
24
|
+
value: string;
|
|
25
|
+
key: string;
|
|
26
|
+
}[] | undefined;
|
|
27
|
+
depends_on?: string[] | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
severity: "ignore" | "info" | "warning" | "error" | "forbidden";
|
|
30
|
+
options?: string[] | undefined;
|
|
31
|
+
compare?: {
|
|
32
|
+
value: string;
|
|
33
|
+
key: string;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
depends_on?: string[] | undefined;
|
|
36
|
+
}>>;
|
|
37
|
+
export type GtfsValidationRule = z.infer<typeof GtfsValidationRuleSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { GtfsValidationRuleCompareSchema } from './compare.js';
|
|
3
|
+
import { SeverityStatusSchema } from '@tmlmobilidade/go-types-shared';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a GTFS validator rule.
|
|
7
|
+
* @see https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#211-rules
|
|
8
|
+
*/
|
|
9
|
+
export const GtfsValidationRuleSchema = z.record(z.string(), z.object({
|
|
10
|
+
compare: z.array(GtfsValidationRuleCompareSchema).default([]).optional(),
|
|
11
|
+
depends_on: z.array(z.string()).default([]).optional(),
|
|
12
|
+
options: z.array(z.string()).default([]).optional(),
|
|
13
|
+
severity: SeverityStatusSchema,
|
|
14
|
+
}));
|