You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 56a4d89
Browse filesBrowse the repository at this point in the historyBrowse files
feat(codegen): uniform entity selection across ports and a linear Java metadata loader (#588)
* feat: Java loader handles large models; even out object selection across ports
Java loader (also Kotlin):
- Remove the quadratic child-key check (list -> set) and resolve references
through the per-type name index. 20 copies of the canonical model
(1,160 objects) load in about 2 s CPU; it previously exceeded the 30 s timeout.
- The 30 s init timeout is now a setting: LoaderOptions.setInitTimeoutMs, loader
arg initTimeoutMs, -Dmeta.loaderTimeoutMs on the Maven plugin, or
-Dmetaobjects.loader.initTimeoutMs. LargeModelLoadTest holds a CPU budget.
Selection parity:
- codegen-spring and codegen-kotlin generators now honour <filters>
(confirmed by running that they ignored them before).
- mvn metaobjects:generate -Dmeta.entities=A,B narrows per-object output for
Java and Kotlin; whole-model files still render from the whole model, a
narrowed run sweeps no orphans, and blank or unknown names fail the goal.
- C# dotnet meta gen/verify --codegen --entities, with the same semantics.
- Python gen lists only the files it changed and counts the rest unchanged.
- Selection documented on every port page; CHANGELOG under [Unreleased].
* feat(cli): meta gen refuses a positional name that matches no object
Every other port refuses an unknown --entities / meta.entities name; TypeScript
dropped it silently when another name matched and only warned when none did.
Now exit 2 with the same wording, before anything is written.
* no-mistakes(review): apply reviewer inline fixes
* no-mistakes(review): apply reviewer inline fixes
* no-mistakes(review): Narrow template scopes; keep C# shared files whole
* no-mistakes(document): Fix stale entity-selection references in docs
Copy file name to clipboardExpand all lines: CHANGELOG.md
+27-2Lines changed: 27 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,10 @@ loaded before stops loading. This vocabulary ships in 1.3.0 with `metamodelVersi
25
25
assigned one (`row.Role = ...`) no longer compiles. The value belongs to the server: set it
26
26
through a database default or EF Core (`db.Entry(row).Property(r => r.Role).CurrentValue`),
27
27
which writes private setters.
28
+
- **Java and Kotlin: `<filters>` now narrow every generator.** The `codegen-spring` and
29
+
`codegen-kotlin` generators ignored a generator's `<filters>` and wrote every object; they now
30
+
honour them, as the `codegen-base` generators always did. A pom whose filters were inert
31
+
generates fewer files: remove the `<filters>` that no longer describe what you want.
28
32
29
33
### Security
30
34
@@ -92,6 +96,21 @@ loaded before stops loading. This vocabulary ships in 1.3.0 with `metamodelVersi
92
96
the new `fixtures/writer-conformance/` corpus. No shipped generator uses the writer yet, so
93
97
generated output does not change in this release.
94
98
99
+
- **Select objects to regenerate in every port.** C# `dotnet meta gen --entities A,B` (and
100
+
`verify --codegen --entities`) and, for Java and Kotlin, `mvn metaobjects:generate
101
+
-Dmeta.entities=A,B` regenerate only the named objects' files, like TypeScript's
102
+
`meta gen A B` and Python's `--entities`. Names are short object names. A file built from the
103
+
whole model (C#'s `AppDbContext`, the Java and Kotlin validator registry, report export writer
104
+
and binding provider) still renders from the whole model, a narrowed run neither deletes nor
105
+
forgets the other objects' files, and a blank selection or a name that matches no object is
106
+
refused (exit 2 in C#, a failed goal in Maven).
107
+
- **`meta gen <Name>...` refuses a name that matches no object**, with exit 2 and nothing
108
+
written, as Python, C# and the Maven plugin do. It used to drop the unknown name silently
109
+
when another name matched, and only warn when none did.
110
+
- **The Java loader's initialization timeout is a setting.** It stays 30 seconds by default. Raise
111
+
it with `-Dmeta.loaderTimeoutMs` (or `<loaderTimeoutMs>`) on the Maven plugin,
112
+
`LoaderOptions.setInitTimeoutMs`, the loader argument `initTimeoutMs`, or the system property
113
+
`metaobjects.loader.initTimeoutMs`; the timeout error names them.
95
114
- **A page size for generated list routes: `api.pagination`, in every port.** An external review
96
115
of 1.2.0 found that list endpoints had no hard cap: the TypeScript and C# routes returned the
97
116
whole table when `limit` was omitted, and `?limit=100000` was accepted in every port. The new
@@ -322,15 +341,21 @@ loaded before stops loading. This vocabulary ships in 1.3.0 with `metamodelVersi
322
341
323
342
### Fixed
324
343
344
+
- **The Java loader loads a large model.** Each child added to a node was checked against a
345
+
list of the keys already added, so a root with 1,160 objects took more than the 30-second
346
+
timeout to load and failed. The check is a set lookup now, and a reference resolves through
347
+
the per-type name index instead of a scan of the root. Twenty copies of the canonical
348
+
conformance model (1,160 objects) load in about 2 seconds of CPU, and `LargeModelLoadTest`
349
+
holds that to a budget. Java and Kotlin.
325
350
- **`gen <Entity>` no longer shrinks the files rendered from the whole model.** Narrowing a run
326
351
to some entities (`meta gen Post`, Python `metaobjects gen --entities Post`) handed every
327
352
generator only the named entities, so a whole-model file (the TypeScript barrel and Cube
328
353
model, Python's shared enums module, duration codec and report writers, and the object index
329
354
Python's entity and route generators resolve relations through) was rendered from just them. A narrowed run now writes only the named entities' own files,
330
355
and every whole-model file it writes is byte-identical to a full run's. A generator sees the
331
356
whole model in `ctx.entities` and the narrowing as `ctx.selected`; `perEntity` (`per_entity`)
332
-
applies it. A Python target's declared `entities` still bounds that target's model. C# and
333
-
Java take no entity filter and were not affected. Two consequences to expect: a narrowed run
357
+
applies it. A Python target's declared `entities` still bounds that target's model. The C# and
358
+
Maven entity selection added in this release follows the same rule. Two consequences to expect: a narrowed run
334
359
checks the whole model as a full run does (a sourced object with no `dialect`, colliding
335
360
collection names), because the files it writes are rendered from it; and an owned generator
336
361
that writes one file per object by looping over `ctx.entities` itself, instead of through
0 commit comments