Skip to content

Commit a5aa1b6

Browse files
fix: Fix broken exports due to multiple schema
- Fix id exporter and registry exporter - Fix graphql inspector - Change the enums to the correct format in sample data files - Fix vspec export by fixing the unit enums - Check-in more unit enums Signed-off-by: Mustafa Kaptan <[email protected]>
1 parent cfd3a3f commit a5aa1b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3127
-564
lines changed

docs-gen/content/docs/tools/units-cli.md

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,47 @@ The S2DM Units CLI provides integration with the [QUDT (Quantities, Units, Dimen
2121

2222
### `s2dm units sync`
2323

24-
Synchronizes unit definitions from the QUDT repository and generates GraphQL enum files.
24+
Synchronizes unit definitions from the QUDT repository and generates GraphQL enum files in the `S2DM_HOME` directory (`~/.s2dm/units/qudt`).
25+
26+
{{% notice note %}}
27+
Unit files are downloaded to `~/.s2dm/units/qudt` to prevent users from modifying them. This is a temporary solution. In the future, QUDT unit GraphQL files will be moved to a separate repository and referenced/downloaded from there.
28+
{{% /notice %}}
2529

2630
**Syntax:**
2731
```bash
28-
s2dm units sync --output-dir <path> [--version <version>] [--dry-run]
32+
s2dm units sync [--version <version>] [--dry-run]
2933
```
3034

3135
**Examples:**
3236
```bash
3337
# Sync latest version
34-
s2dm units sync --output-dir units
38+
s2dm units sync
3539

3640
# Sync specific version
37-
s2dm units sync --version v3.1.5 --output-dir units
41+
s2dm units sync --version v3.1.5
3842

3943
# Check what would be generated without creating files
40-
s2dm units sync --output-dir units --dry-run
41-
42-
# Sync to custom directory
43-
s2dm units sync --version v3.1.5 --output-dir path/to/qudt/units/
44+
s2dm units sync --dry-run
4445
```
4546

4647
**Options:**
47-
- `--output-dir` (required): Directory where generated unit enums will be written
4848
- `--version` (optional): QUDT version string. Defaults to latest release if not specified
4949
- `--dry-run` (optional): Show how many enum files would be generated without creating them
5050

5151
**Output:**
52-
- Creates `<QuantityKindUnitEnum>.graphql` files (e.g., `LengthUnitEnum.graphql`)
52+
- Creates `<QuantityKindUnitEnum>.graphql` files in `~/.s2dm/units/qudt` (e.g., `LengthUnitEnum.graphql`)
5353
- Generates `metadata.json` with version information
5454
- Reports number of enum files generated
5555

5656
### `s2dm units check-version`
5757

58-
Compares the local synced QUDT version with the latest available version.
58+
Compares the local synced QUDT version with the latest available version. By default, checks the `~/.s2dm/units/qudt` directory.
5959

6060
**Syntax:**
6161
```bash
62-
s2dm units check-version --qudt-units-dir <path>
63-
```
64-
65-
**Example:**
66-
```bash
67-
s2dm units check-version --qudt-units-dir units/external_qudt
62+
s2dm units check-version
6863
```
6964

70-
**Options:**
71-
- `--qudt-units-dir` (required, ~/.s2dm/units/qudt by default): Directory containing generated QUDT unit enums
72-
7365
**Output:**
7466
- `✓ Units are up to date.` if current version matches latest
7567
- `⚠ There is a newer release available: X.Y.Z` if update is needed
@@ -102,26 +94,31 @@ enum LengthUnitEnum @reference(uri: "http://qudt.org/vocab/quantitykind/Length",
10294

10395
## Directory Structure
10496

105-
When using both QUDT and custom units, organize them as follows:
97+
QUDT units are stored in the `S2DM_HOME` directory:
98+
99+
```
100+
~/.s2dm/units/qudt/ # QUDT units (generated, read-only)
101+
├── metadata.json # Version metadata
102+
├── LengthUnitEnum.graphql # Length units
103+
├── VelocityUnitEnum.graphql # Velocity units
104+
└── ... (500+ more unit enums)
105+
```
106+
107+
If you need custom units specific to your domain, create them in your project directory:
106108

107109
```
108-
units/
109-
├── external_qudt/ # QUDT units (generated)
110-
│ ├── metadata.json # Version metadata
111-
│ ├── LengthUnitEnum.graphql # Length units
112-
│ ├── VelocityUnitEnum.graphql # Velocity units
113-
│ └── ... (500+ more unit enums)
114-
└── custom/ # Custom units (manual)
115-
├── MyDomainUnitEnum.graphql # Custom domain units
116-
└── SpecialUnitEnum.graphql # Special use case units
110+
units/custom/ # Custom units (manual, in your project)
111+
├── MyDomainUnitEnum.graphql # Custom domain units
112+
└── SpecialUnitEnum.graphql # Special use case units
117113
```
118114

119115
## Workflow Example
120116

121117
1. **Initial Setup**: Sync units from QUDT
122118
```bash
123-
s2dm units sync --version v3.1.5 --output-dir units/external_qudt
119+
s2dm units sync --version v3.1.5
124120
```
121+
This downloads unit enums to `~/.s2dm/units/qudt`.
125122

126123
2. **Use Units in Schema Development**: Reference generated enums
127124
```graphql
@@ -133,12 +130,12 @@ units/
133130

134131
3. **Check for Updates**: Periodically check for new QUDT versions
135132
```bash
136-
s2dm units check-version --qudt-units-dir units/external_qudt
133+
s2dm units check-version
137134
```
138135

139136
4. **Update When Needed**: Sync newer versions as they become available
140137
```bash
141-
s2dm units sync --version v3.2.0 --output-dir units/external_qudt
138+
s2dm units sync --version v3.2.0
142139
```
143140

144141
## Why URI-Based Symbols?
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Generated from QUDT units catalog version v3.1.6
2+
enum AccelerationUnitEnum @reference(uri: "http://qudt.org/vocab/quantitykind/Acceleration", versionTag: "v3.1.6") {
3+
"""Centimeter per Square Second | UCUM: cm.s-2"""
4+
CENTIM_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/CentiM-PER-SEC2", versionTag: "v3.1.6")
5+
6+
"""Foot per Square Second | UCUM: [ft_i].s-2"""
7+
FT_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/FT-PER-SEC2", versionTag: "v3.1.6")
8+
9+
"""Gravity | UCUM: [g]"""
10+
G @reference(uri: "http://qudt.org/vocab/unit/G", versionTag: "v3.1.6")
11+
12+
"""Galileo | UCUM: Gal"""
13+
GALILEO @reference(uri: "http://qudt.org/vocab/unit/GALILEO", versionTag: "v3.1.6")
14+
15+
"""Inch per Square Second | UCUM: [in_i].s-2"""
16+
IN_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/IN-PER-SEC2", versionTag: "v3.1.6")
17+
18+
"""Kilometer per Square Second | UCUM: km.s-2"""
19+
KILOM_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/KiloM-PER-SEC2", versionTag: "v3.1.6")
20+
21+
"""Kilopascal Square Meter per Gram | UCUM: kPa.m2.g-1"""
22+
KILOPA_M2_PER_GM @reference(uri: "http://qudt.org/vocab/unit/KiloPA-M2-PER-GM", versionTag: "v3.1.6")
23+
24+
"""Knot per Second | UCUM: [kn_i].s-1"""
25+
KN_PER_SEC @reference(uri: "http://qudt.org/vocab/unit/KN-PER-SEC", versionTag: "v3.1.6")
26+
27+
"""Microgravity | UCUM: u[g]"""
28+
MICROG @reference(uri: "http://qudt.org/vocab/unit/MicroG", versionTag: "v3.1.6")
29+
30+
"""Micrometer per Square Second | UCUM: um.s-2"""
31+
MICROM_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/MicroM-PER-SEC2", versionTag: "v3.1.6")
32+
33+
"""Milligravity | UCUM: m[g]"""
34+
MILLIG @reference(uri: "http://qudt.org/vocab/unit/MilliG", versionTag: "v3.1.6")
35+
36+
"""Milligalileo | UCUM: mGal"""
37+
MILLIGALILEO @reference(uri: "http://qudt.org/vocab/unit/MilliGALILEO", versionTag: "v3.1.6")
38+
39+
"""Millimeter per Square Second | UCUM: mm.s-2"""
40+
MILLIM_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/MilliM-PER-SEC2", versionTag: "v3.1.6")
41+
42+
"""Mile Us Statute per Square Second | UCUM: [mi_us].s-2"""
43+
MI_US_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/MI_US-PER-SEC2", versionTag: "v3.1.6")
44+
45+
"""Meter per Square Second | UCUM: m.s-2"""
46+
M_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/M-PER-SEC2", versionTag: "v3.1.6")
47+
48+
"""Yard per Square Second | UCUM: [yd_i].s-2"""
49+
YD_PER_SEC2 @reference(uri: "http://qudt.org/vocab/unit/YD-PER-SEC2", versionTag: "v3.1.6")
50+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Generated from QUDT units catalog version v3.1.6
2+
enum DisplacementCurrentUnitEnum @reference(uri: "http://qudt.org/vocab/quantitykind/DisplacementCurrent", versionTag: "v3.1.6") {
3+
"""Ampere | UCUM: A"""
4+
A @reference(uri: "http://qudt.org/vocab/unit/A", versionTag: "v3.1.6")
5+
6+
"""Attoampere | UCUM: aA"""
7+
ATTOA @reference(uri: "http://qudt.org/vocab/unit/AttoA", versionTag: "v3.1.6")
8+
9+
"""Femtoampere | UCUM: fA"""
10+
FEMTOA @reference(uri: "http://qudt.org/vocab/unit/FemtoA", versionTag: "v3.1.6")
11+
12+
"""Gigaampere | UCUM: GA"""
13+
GIGAA @reference(uri: "http://qudt.org/vocab/unit/GigaA", versionTag: "v3.1.6")
14+
15+
"""Petaampere | UCUM: PA"""
16+
PETAA @reference(uri: "http://qudt.org/vocab/unit/PetaA", versionTag: "v3.1.6")
17+
18+
"""Teraampere | UCUM: TA"""
19+
TERAA @reference(uri: "http://qudt.org/vocab/unit/TeraA", versionTag: "v3.1.6")
20+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Generated from QUDT units catalog version v3.1.6
2+
enum ElectricChargeUnitEnum @reference(uri: "http://qudt.org/vocab/quantitykind/ElectricCharge", versionTag: "v3.1.6") {
3+
"""Attocoulomb | UCUM: aC"""
4+
ATTOC @reference(uri: "http://qudt.org/vocab/unit/AttoC", versionTag: "v3.1.6")
5+
6+
"""Ampere Hour | UCUM: A.h"""
7+
A_HR @reference(uri: "http://qudt.org/vocab/unit/A-HR", versionTag: "v3.1.6")
8+
9+
"""Ampere Second | UCUM: A.s"""
10+
A_SEC @reference(uri: "http://qudt.org/vocab/unit/A-SEC", versionTag: "v3.1.6")
11+
12+
"""Coulomb | UCUM: C"""
13+
C @reference(uri: "http://qudt.org/vocab/unit/C", versionTag: "v3.1.6")
14+
15+
"""Centicoulomb | UCUM: cC"""
16+
CENTIC @reference(uri: "http://qudt.org/vocab/unit/CentiC", versionTag: "v3.1.6")
17+
18+
"""Abcoulomb | UCUM: 10.C"""
19+
C_AB @reference(uri: "http://qudt.org/vocab/unit/C_Ab", versionTag: "v3.1.6")
20+
21+
"""Statcoulomb"""
22+
C_STAT @reference(uri: "http://qudt.org/vocab/unit/C_Stat", versionTag: "v3.1.6")
23+
24+
"""Decacoulomb | UCUM: daC"""
25+
DECAC @reference(uri: "http://qudt.org/vocab/unit/DecaC", versionTag: "v3.1.6")
26+
27+
"""Decicoulomb | UCUM: dC"""
28+
DECIC @reference(uri: "http://qudt.org/vocab/unit/DeciC", versionTag: "v3.1.6")
29+
30+
"""Elementary Charge | UCUM: [e]"""
31+
E @reference(uri: "http://qudt.org/vocab/unit/E", versionTag: "v3.1.6")
32+
33+
"""Elementary Charge | UCUM: [e]"""
34+
ELEMENTARYCHARGE @reference(uri: "http://qudt.org/vocab/unit/ElementaryCharge", versionTag: "v3.1.6")
35+
36+
"""Exacoulomb | UCUM: EC"""
37+
EXAC @reference(uri: "http://qudt.org/vocab/unit/ExaC", versionTag: "v3.1.6")
38+
39+
"""Faraday"""
40+
F @reference(uri: "http://qudt.org/vocab/unit/F", versionTag: "v3.1.6")
41+
42+
"""Femtocoulomb | UCUM: fC"""
43+
FEMTOC @reference(uri: "http://qudt.org/vocab/unit/FemtoC", versionTag: "v3.1.6")
44+
45+
"""Franklin"""
46+
FR @reference(uri: "http://qudt.org/vocab/unit/FR", versionTag: "v3.1.6")
47+
48+
"""Gigacoulomb | UCUM: GC"""
49+
GIGAC @reference(uri: "http://qudt.org/vocab/unit/GigaC", versionTag: "v3.1.6")
50+
51+
"""Hectocoulomb | UCUM: hC"""
52+
HECTOC @reference(uri: "http://qudt.org/vocab/unit/HectoC", versionTag: "v3.1.6")
53+
54+
"""Kiloampere Hour | UCUM: kA.h"""
55+
KILOA_HR @reference(uri: "http://qudt.org/vocab/unit/KiloA-HR", versionTag: "v3.1.6")
56+
57+
"""Kilocoulomb | UCUM: kC"""
58+
KILOC @reference(uri: "http://qudt.org/vocab/unit/KiloC", versionTag: "v3.1.6")
59+
60+
"""Kilojoule per Kilovolt | UCUM: kJ.kV-1"""
61+
KILOJ_PER_KILOV @reference(uri: "http://qudt.org/vocab/unit/KiloJ-PER-KiloV", versionTag: "v3.1.6")
62+
63+
"""Megacoulomb | UCUM: MC"""
64+
MEGAC @reference(uri: "http://qudt.org/vocab/unit/MegaC", versionTag: "v3.1.6")
65+
66+
"""Microcoulomb | UCUM: uC"""
67+
MICROC @reference(uri: "http://qudt.org/vocab/unit/MicroC", versionTag: "v3.1.6")
68+
69+
"""Milliampere Hour | UCUM: mA.h"""
70+
MILLIA_HR @reference(uri: "http://qudt.org/vocab/unit/MilliA-HR", versionTag: "v3.1.6")
71+
72+
"""Milliampere Second | UCUM: mA.s"""
73+
MILLIA_SEC @reference(uri: "http://qudt.org/vocab/unit/MilliA-SEC", versionTag: "v3.1.6")
74+
75+
"""Millicoulomb | UCUM: mC"""
76+
MILLIC @reference(uri: "http://qudt.org/vocab/unit/MilliC", versionTag: "v3.1.6")
77+
78+
"""Nanocoulomb | UCUM: nC"""
79+
NANOC @reference(uri: "http://qudt.org/vocab/unit/NanoC", versionTag: "v3.1.6")
80+
81+
"""Petacoulomb | UCUM: PC"""
82+
PETAC @reference(uri: "http://qudt.org/vocab/unit/PetaC", versionTag: "v3.1.6")
83+
84+
"""Picocoulomb | UCUM: pC"""
85+
PICOC @reference(uri: "http://qudt.org/vocab/unit/PicoC", versionTag: "v3.1.6")
86+
87+
"""Planck Charge"""
88+
PLANCKCHARGE @reference(uri: "http://qudt.org/vocab/unit/PlanckCharge", versionTag: "v3.1.6")
89+
90+
"""Teracoulomb | UCUM: TC"""
91+
TERAC @reference(uri: "http://qudt.org/vocab/unit/TeraC", versionTag: "v3.1.6")
92+
93+
"""Yoctocoulomb | UCUM: yC"""
94+
YOCTOC @reference(uri: "http://qudt.org/vocab/unit/YoctoC", versionTag: "v3.1.6")
95+
96+
"""Yottacoulomb | UCUM: YC"""
97+
YOTTAC @reference(uri: "http://qudt.org/vocab/unit/YottaC", versionTag: "v3.1.6")
98+
99+
"""Zeptocoulomb | UCUM: zC"""
100+
ZEPTOC @reference(uri: "http://qudt.org/vocab/unit/ZeptoC", versionTag: "v3.1.6")
101+
102+
"""Zettacoulomb | UCUM: ZC"""
103+
ZETTAC @reference(uri: "http://qudt.org/vocab/unit/ZettaC", versionTag: "v3.1.6")
104+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Generated from QUDT units catalog version v3.1.6
2+
enum ElectricPotentialUnitEnum @reference(uri: "http://qudt.org/vocab/quantitykind/ElectricPotential", versionTag: "v3.1.6") {
3+
"""Exavolt | UCUM: EV"""
4+
EXAV @reference(uri: "http://qudt.org/vocab/unit/ExaV", versionTag: "v3.1.6")
5+
6+
"""Femtovolt | UCUM: fV"""
7+
FEMTOV @reference(uri: "http://qudt.org/vocab/unit/FemtoV", versionTag: "v3.1.6")
8+
9+
"""Gigavolt | UCUM: GV"""
10+
GIGAV @reference(uri: "http://qudt.org/vocab/unit/GigaV", versionTag: "v3.1.6")
11+
12+
"""Kilovolt | UCUM: kV"""
13+
KILOV @reference(uri: "http://qudt.org/vocab/unit/KiloV", versionTag: "v3.1.6")
14+
15+
"""Megavolt | UCUM: MV"""
16+
MEGAV @reference(uri: "http://qudt.org/vocab/unit/MegaV", versionTag: "v3.1.6")
17+
18+
"""Microvolt | UCUM: uV"""
19+
MICROV @reference(uri: "http://qudt.org/vocab/unit/MicroV", versionTag: "v3.1.6")
20+
21+
"""Millivolt | UCUM: mV"""
22+
MILLIV @reference(uri: "http://qudt.org/vocab/unit/MilliV", versionTag: "v3.1.6")
23+
24+
"""Nanovolt | UCUM: nV"""
25+
NANOV @reference(uri: "http://qudt.org/vocab/unit/NanoV", versionTag: "v3.1.6")
26+
27+
"""Petavolt | UCUM: PV"""
28+
PETAV @reference(uri: "http://qudt.org/vocab/unit/PetaV", versionTag: "v3.1.6")
29+
30+
"""Picovolt | UCUM: pV"""
31+
PICOV @reference(uri: "http://qudt.org/vocab/unit/PicoV", versionTag: "v3.1.6")
32+
33+
"""Planck Volt"""
34+
PLANCKVOLT @reference(uri: "http://qudt.org/vocab/unit/PlanckVolt", versionTag: "v3.1.6")
35+
36+
"""Teravolt | UCUM: TV"""
37+
TERAV @reference(uri: "http://qudt.org/vocab/unit/TeraV", versionTag: "v3.1.6")
38+
39+
"""Volt | UCUM: V"""
40+
V @reference(uri: "http://qudt.org/vocab/unit/V", versionTag: "v3.1.6")
41+
42+
"""Abvolt | UCUM: 10.nV"""
43+
V_AB @reference(uri: "http://qudt.org/vocab/unit/V_Ab", versionTag: "v3.1.6")
44+
45+
"""Statvolt"""
46+
V_STAT @reference(uri: "http://qudt.org/vocab/unit/V_Stat", versionTag: "v3.1.6")
47+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Generated from QUDT units catalog version v3.1.6
2+
enum ElectricPowerUnitEnum @reference(uri: "http://qudt.org/vocab/quantitykind/ElectricPower", versionTag: "v3.1.6") {
3+
"""Exawatt | UCUM: EW"""
4+
EXAW @reference(uri: "http://qudt.org/vocab/unit/ExaW", versionTag: "v3.1.6")
5+
6+
"""Gigawatt | UCUM: GW"""
7+
GIGAW @reference(uri: "http://qudt.org/vocab/unit/GigaW", versionTag: "v3.1.6")
8+
9+
"""Kilowatt | UCUM: kW"""
10+
KILOW @reference(uri: "http://qudt.org/vocab/unit/KiloW", versionTag: "v3.1.6")
11+
12+
"""Megawatt | UCUM: MW"""
13+
MEGAW @reference(uri: "http://qudt.org/vocab/unit/MegaW", versionTag: "v3.1.6")
14+
15+
"""Microwatt | UCUM: uW"""
16+
MICROW @reference(uri: "http://qudt.org/vocab/unit/MicroW", versionTag: "v3.1.6")
17+
18+
"""Milliwatt | UCUM: mW"""
19+
MILLIW @reference(uri: "http://qudt.org/vocab/unit/MilliW", versionTag: "v3.1.6")
20+
21+
"""Nanowatt | UCUM: nW"""
22+
NANOW @reference(uri: "http://qudt.org/vocab/unit/NanoW", versionTag: "v3.1.6")
23+
24+
"""Petawatt | UCUM: PW"""
25+
PETAW @reference(uri: "http://qudt.org/vocab/unit/PetaW", versionTag: "v3.1.6")
26+
27+
"""Picowatt | UCUM: pW"""
28+
PICOW @reference(uri: "http://qudt.org/vocab/unit/PicoW", versionTag: "v3.1.6")
29+
30+
"""Terajoule per Second | UCUM: TJ.s-1"""
31+
TERAJ_PER_SEC @reference(uri: "http://qudt.org/vocab/unit/TeraJ-PER-SEC", versionTag: "v3.1.6")
32+
33+
"""Terawatt | UCUM: TW"""
34+
TERAW @reference(uri: "http://qudt.org/vocab/unit/TeraW", versionTag: "v3.1.6")
35+
36+
"""Watt | UCUM: W"""
37+
W @reference(uri: "http://qudt.org/vocab/unit/W", versionTag: "v3.1.6")
38+
}

0 commit comments

Comments
 (0)