Repository navigation
Commit 4b90500
committed
feat(metamodel): ADR-0036 Wave 3 — field.uri, field.inet subtypes + @stringformat (TS reference)
Implements the TypeScript reference for ADR-0036 decision #2 / ADR-0037:
two new field subtypes (concepts with a native type + behavior) and one new
validation attribute (a plain validated string).
Metamodel (spec/metamodel/field.json + regenerated embed):
- field.uri — a URI/URL string. TS binds to `string` (no native URI type, same
as field.uuid); other ports bind native URI. DB column = text. Ships WITHOUT
@kind in v1 (native type subsumes url/urn).
- field.inet — an IP-address string (v4/v6). TS binds to `string`; other ports
bind native IP. DB column = Postgres-native `inet`. Ships WITHOUT @kind in v1.
- @stringformat on field.string — closed set {email|hostname}; the field stays a
plain string, codegen owns the canonical matcher. Named distinctly to avoid
colliding with template.* @Format.
Constants + runtime: FIELD_SUBTYPE_URI/INET, FIELD_ATTR_STRING_FORMAT +
STRING_FORMAT_EMAIL/HOSTNAME; FIELD_DATA_TYPE binds uri/inet → string; op-bands
(uri = string-like eq/ne/in/like/isNull; inet = uuid-like eq/ne/in/isNull).
codegen-ts:
- column-mapper: uri → text, inet → inet (Drizzle pg-core native inet()),
both text on SQLite; native TS binding stays string.
- Zod: field.uri → z.string().url(); field.inet → z.string().ip();
@stringformat email → z.string().email(); hostname → codegen-owned canonical
hostname regex (not author validator.regex).
- inferred-types / field-meta / fr010 field-mapping: uri/inet → string scalar.
migrate-ts (schema DDL stays TS-owned): SqlType gains `inet`; uri → text,
inet → INET (Postgres) / TEXT (SQLite); introspect maps inet back.
Goldens regenerated: registry-conformance expected-registry.json (uri/inet
entries + @stringformat allowedValues), coverage-report.json baseline,
metamodel-docs. New conformance fixture field-uri-inet-stringformat gates the
new vocab through the loader under strict mode.
Other 4 ports must replicate the shared golden + bind the NATIVE type per port
(Java java.net.URI / InetAddress, C# System.Uri / IPAddress, Python urllib /
ipaddress, Kotlin via JVM) and emit idiomatic validation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GF9xLEQZaPus5Y6opk398n1 parent cf70774 commit 4b90500
25 files changed
Lines changed: 738 additions & 10 deletions
File tree
- fixtures
- conformance/field-uri-inet-stringformat
- input
- metamodel-docs/expected
- types
- registry-conformance
- server/typescript/packages
- codegen-ts
- src
- templates
- test
- templates
- metadata
- src/core
- field
- query
- test
- migrate-ts/src
- emit
- introspect
- spec/metamodel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| 125 | + | |
121 | 126 | | |
122 | 127 | | |
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
| 133 | + | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| |||
0 commit comments