Skip to content

Commit 80e7bf1

Browse files
feat: Generate REC/2023/03 liquid chromatography tabular schema models (#1188)
## Summary - Adds support for flat tabular schemas (root `properties` without `allOf`) in the codegen pipeline - Generates the LC REC/2023/03 model, which uses this older flat format — previously produced empty output - Stabilizes unit dedup ordering in `units.py` and `quantity_values.py` so adding older schema dependencies doesn't change existing unit strings ## Changes - **`generator.py`**: Broaden `_is_adm_schema` to detect flat schemas with nested object properties; merge root-level properties in `_generate_adm_module` before `allOf` processing - **`generate.py`**: Add secondary sort key for deterministic unit class name assignment; read existing `quantity_values.py` to preserve committed unit strings when older schemas introduce alternate spellings - **New files**: Cached JSON schemas (core REC/2021/12, core REC/2022/12, qudt REC/2021/12, qudt REC/2023/03, LC REC/2023/03) and generated models ## Test plan - [x] `hatch run test_all.py3.10:pytest tests/ -x -q` — all 1112 tests pass - [x] `hatch run lint` — clean (ruff, black, mypy) - [x] `hatch run scripts:generate-schemas --all` produces no changes to existing committed models - [x] `test_generated_models_are_up_to_date` passes (regeneration in tmp dir matches committed) - [x] `test_single_technique_smoke` passes for all cached schemas 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1d43546 commit 80e7bf1

12 files changed

Lines changed: 22262 additions & 10 deletions

File tree

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# generated by allotropy.schema_gen
2+
# Re-exports imported types so downstream modules can import from here.
3+
# ruff: noqa: F401
4+
5+
from __future__ import annotations
6+
7+
from dataclasses import dataclass, field
8+
from typing import Any
9+
10+
from allotropy.allotrope.models.shared.definitions.definitions import (
11+
TClass,
12+
TQuantityValue,
13+
TUnit,
14+
)
15+
16+
17+
@dataclass(frozen=True, kw_only=True)
18+
class Asm:
19+
pass
20+
21+
22+
@dataclass(frozen=True, kw_only=True)
23+
class MixedItem:
24+
field_type: TClass = field(metadata={"json_name": "@type"})
25+
26+
27+
@dataclass(frozen=True, kw_only=True)
28+
class OrderedItem:
29+
field_index: int | None = field(default=None, metadata={"json_name": "@index"})
30+
31+
32+
TArray = list[Any]
33+
34+
35+
@dataclass(frozen=True, kw_only=True)
36+
class TBooleanValueItem:
37+
field_type: TClass = field(metadata={"json_name": "@type"})
38+
value: bool
39+
40+
41+
@dataclass(frozen=True, kw_only=True)
42+
class TByteValueItem:
43+
field_type: TClass = field(metadata={"json_name": "@type"})
44+
value: int
45+
46+
47+
@dataclass(frozen=True, kw_only=True)
48+
class TDateTimeStampValueItem:
49+
field_type: TClass = field(metadata={"json_name": "@type"})
50+
value: str
51+
52+
53+
@dataclass(frozen=True, kw_only=True)
54+
class TDateTimeValueItem:
55+
field_type: TClass = field(metadata={"json_name": "@type"})
56+
value: str
57+
58+
59+
@dataclass(frozen=True, kw_only=True)
60+
class TDateValueItem:
61+
field_type: TClass = field(metadata={"json_name": "@type"})
62+
value: str
63+
64+
65+
@dataclass(frozen=True, kw_only=True)
66+
class TDecimalValueItem:
67+
field_type: TClass = field(metadata={"json_name": "@type"})
68+
value: float
69+
70+
71+
@dataclass(frozen=True, kw_only=True)
72+
class TDoubleValueItem:
73+
field_type: TClass = field(metadata={"json_name": "@type"})
74+
value: float
75+
76+
77+
@dataclass(frozen=True, kw_only=True)
78+
class TDurationValueItem:
79+
field_type: TClass = field(metadata={"json_name": "@type"})
80+
value: str
81+
82+
83+
@dataclass(frozen=True, kw_only=True)
84+
class TFloatValueItem:
85+
field_type: TClass = field(metadata={"json_name": "@type"})
86+
value: float
87+
88+
89+
@dataclass(frozen=True, kw_only=True)
90+
class TIRIValueItem:
91+
field_type: TClass = field(metadata={"json_name": "@type"})
92+
value: str
93+
94+
95+
@dataclass(frozen=True, kw_only=True)
96+
class TIntValueItem:
97+
field_type: TClass = field(metadata={"json_name": "@type"})
98+
value: int
99+
100+
101+
@dataclass(frozen=True, kw_only=True)
102+
class TIntegerValueItem:
103+
field_type: TClass = field(metadata={"json_name": "@type"})
104+
value: int
105+
106+
107+
@dataclass(frozen=True, kw_only=True)
108+
class TLongValueItem:
109+
field_type: TClass = field(metadata={"json_name": "@type"})
110+
value: int
111+
112+
113+
TNamed = str
114+
115+
116+
@dataclass(frozen=True, kw_only=True)
117+
class TObject:
118+
pass
119+
120+
121+
TReference = str
122+
123+
124+
TResource = str
125+
126+
127+
@dataclass(frozen=True, kw_only=True)
128+
class TShortValueItem:
129+
field_type: TClass = field(metadata={"json_name": "@type"})
130+
value: int
131+
132+
133+
@dataclass(frozen=True, kw_only=True)
134+
class TStringValueItem:
135+
field_type: TClass = field(metadata={"json_name": "@type"})
136+
value: str
137+
138+
139+
@dataclass(frozen=True, kw_only=True)
140+
class TTimeValueItem:
141+
field_type: TClass = field(metadata={"json_name": "@type"})
142+
value: str
143+
144+
145+
@dataclass(frozen=True, kw_only=True)
146+
class TUnsignedByteValueItem:
147+
field_type: TClass = field(metadata={"json_name": "@type"})
148+
value: int
149+
150+
151+
@dataclass(frozen=True, kw_only=True)
152+
class TUnsignedIntValueItem:
153+
field_type: TClass = field(metadata={"json_name": "@type"})
154+
value: int
155+
156+
157+
@dataclass(frozen=True, kw_only=True)
158+
class TUnsignedLongValueItem:
159+
field_type: TClass = field(metadata={"json_name": "@type"})
160+
value: int
161+
162+
163+
@dataclass(frozen=True, kw_only=True)
164+
class TUnsignedShortValueItem:
165+
field_type: TClass = field(metadata={"json_name": "@type"})
166+
value: int
167+
168+
169+
TBooleanValue = TBooleanValueItem | bool
170+
171+
172+
TByteValue = TByteValueItem | int
173+
174+
175+
TDateTimeStampValue = TDateTimeStampValueItem | str
176+
177+
178+
TDateTimeValue = TDateTimeValueItem | str
179+
180+
181+
TDateValue = TDateValueItem | str
182+
183+
184+
TDecimalValue = TDecimalValueItem | float
185+
186+
187+
TDoubleValue = TDoubleValueItem | float
188+
189+
190+
TDurationValue = TDurationValueItem | str
191+
192+
193+
TFloatValue = TFloatValueItem | float
194+
195+
196+
TIRIValue = TIRIValueItem | str
197+
198+
199+
TIntValue = TIntValueItem | int
200+
201+
202+
TIntegerValue = TIntegerValueItem | int
203+
204+
205+
TLongValue = TLongValueItem | int
206+
207+
208+
TShortValue = TShortValueItem | int
209+
210+
211+
TStringValue = TStringValueItem | str
212+
213+
214+
TTimeValue = TTimeValueItem | str
215+
216+
217+
TUnsignedByteValue = TUnsignedByteValueItem | int
218+
219+
220+
TUnsignedIntValue = TUnsignedIntValueItem | int
221+
222+
223+
TUnsignedLongValue = TUnsignedLongValueItem | int
224+
225+
226+
TUnsignedShortValue = TUnsignedShortValueItem | int
227+
228+
229+
TNumericValue = (
230+
TByteValue
231+
| TDecimalValue
232+
| TDoubleValue
233+
| TFloatValue
234+
| TIntValue
235+
| TIntegerValue
236+
| TLongValue
237+
| TShortValue
238+
| TUnsignedByteValue
239+
| TUnsignedIntValue
240+
| TUnsignedLongValue
241+
| TUnsignedShortValue
242+
)
243+
244+
245+
TOrderedValue = (
246+
TDateTimeStampValue
247+
| TDateTimeValue
248+
| TDateValue
249+
| TNumericValue
250+
| TStringValue
251+
| TTimeValue
252+
)
253+
254+
255+
@dataclass(frozen=True, kw_only=True)
256+
class TRangeValue:
257+
min_inclusive: TOrderedValue | None = field(
258+
default=None, metadata={"json_name": "minInclusive"}
259+
)
260+
min_exclusive: TOrderedValue | None = field(
261+
default=None, metadata={"json_name": "minExclusive"}
262+
)
263+
max_inclusive: TOrderedValue | None = field(
264+
default=None, metadata={"json_name": "maxInclusive"}
265+
)
266+
max_exclusive: TOrderedValue | None = field(
267+
default=None, metadata={"json_name": "maxExclusive"}
268+
)
269+
unit: TUnit | None = None

0 commit comments

Comments
 (0)