Commit 5c79239
committed
refactor(core): extract VehicleSelectorBase
Pull the shared `dimension` and `comparison` fields of the five vehicle
selector subtypes into a `VehicleSelectorBase` parent, and thread
`discriminator="dimension"` through the `VehicleSelector` annotated
union.
The discriminator turns the union into a Pydantic discriminated union,
so it serializes as JSON Schema's `oneOf` + `discriminator` rather than
`anyOf`. Regenerated segment_baseline_schema.json captures the new
shape.
This is a prerequisite for downstream tooling that walks discriminated
unions structurally (e.g. PySpark codegen for segment's nested vehicle
scoping).
Signed-off-by: Seth Fitzsimmons <seth@mojodna.net>1 parent bc5d681 commit 5c79239
2 files changed
Lines changed: 61 additions & 33 deletions
File tree
- packages
- overture-schema-common/src/overture/schema/common/scoping
- overture-schema-transportation-theme/tests
Lines changed: 22 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 61 | + | |
| 62 | + | |
56 | 63 | | |
57 | 64 | | |
58 | | - | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | | - | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | | - | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 103 | + | |
| 104 | + | |
107 | 105 | | |
108 | 106 | | |
109 | | - | |
110 | 107 | | |
111 | 108 | | |
112 | 109 | | |
| |||
123 | 120 | | |
124 | 121 | | |
125 | 122 | | |
126 | | - | |
| 123 | + | |
| 124 | + | |
127 | 125 | | |
128 | 126 | | |
129 | 127 | | |
| |||
Lines changed: 39 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1862 | 1862 | | |
1863 | 1863 | | |
1864 | 1864 | | |
1865 | | - | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
1866 | 1877 | | |
1867 | 1878 | | |
1868 | 1879 | | |
| |||
1878 | 1889 | | |
1879 | 1890 | | |
1880 | 1891 | | |
1881 | | - | |
1882 | | - | |
| 1892 | + | |
1883 | 1893 | | |
1884 | 1894 | | |
1885 | 1895 | | |
| |||
2025 | 2035 | | |
2026 | 2036 | | |
2027 | 2037 | | |
2028 | | - | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
2029 | 2050 | | |
2030 | 2051 | | |
2031 | 2052 | | |
| |||
2041 | 2062 | | |
2042 | 2063 | | |
2043 | 2064 | | |
2044 | | - | |
2045 | | - | |
| 2065 | + | |
2046 | 2066 | | |
2047 | 2067 | | |
2048 | 2068 | | |
| |||
2173 | 2193 | | |
2174 | 2194 | | |
2175 | 2195 | | |
2176 | | - | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
2177 | 2208 | | |
2178 | 2209 | | |
2179 | 2210 | | |
| |||
2189 | 2220 | | |
2190 | 2221 | | |
2191 | 2222 | | |
2192 | | - | |
2193 | | - | |
| 2223 | + | |
2194 | 2224 | | |
2195 | 2225 | | |
2196 | 2226 | | |
| |||
0 commit comments