Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ loaded before stops loading. This vocabulary ships in 1.3.0 with `metamodelVersi
assigned one (`row.Role = ...`) no longer compiles. The value belongs to the server: set it
through a database default or EF Core (`db.Entry(row).Property(r => r.Role).CurrentValue`),
which writes private setters.
- **Java and Kotlin: `<filters>` now narrow every generator.** The `codegen-spring` and
`codegen-kotlin` generators ignored a generator's `<filters>` and wrote every object; they now
honour them, as the `codegen-base` generators always did. A pom whose filters were inert
generates fewer files: remove the `<filters>` that no longer describe what you want.

### Security

Expand Down Expand Up @@ -92,6 +96,21 @@ loaded before stops loading. This vocabulary ships in 1.3.0 with `metamodelVersi
the new `fixtures/writer-conformance/` corpus. No shipped generator uses the writer yet, so
generated output does not change in this release.

- **Select objects to regenerate in every port.** C# `dotnet meta gen --entities A,B` (and
`verify --codegen --entities`) and, for Java and Kotlin, `mvn metaobjects:generate
-Dmeta.entities=A,B` regenerate only the named objects' files, like TypeScript's
`meta gen A B` and Python's `--entities`. Names are short object names. A file built from the
whole model (C#'s `AppDbContext`, the Java and Kotlin validator registry, report export writer
and binding provider) still renders from the whole model, a narrowed run neither deletes nor
forgets the other objects' files, and a blank selection or a name that matches no object is
refused (exit 2 in C#, a failed goal in Maven).
- **`meta gen <Name>...` refuses a name that matches no object**, with exit 2 and nothing
written, as Python, C# and the Maven plugin do. It used to drop the unknown name silently
when another name matched, and only warn when none did.
- **The Java loader's initialization timeout is a setting.** It stays 30 seconds by default. Raise
it with `-Dmeta.loaderTimeoutMs` (or `<loaderTimeoutMs>`) on the Maven plugin,
`LoaderOptions.setInitTimeoutMs`, the loader argument `initTimeoutMs`, or the system property
`metaobjects.loader.initTimeoutMs`; the timeout error names them.
- **A page size for generated list routes: `api.pagination`, in every port.** An external review
of 1.2.0 found that list endpoints had no hard cap: the TypeScript and C# routes returned the
whole table when `limit` was omitted, and `?limit=100000` was accepted in every port. The new
Expand Down Expand Up @@ -322,15 +341,21 @@ loaded before stops loading. This vocabulary ships in 1.3.0 with `metamodelVersi

### Fixed

- **The Java loader loads a large model.** Each child added to a node was checked against a
list of the keys already added, so a root with 1,160 objects took more than the 30-second
timeout to load and failed. The check is a set lookup now, and a reference resolves through
the per-type name index instead of a scan of the root. Twenty copies of the canonical
conformance model (1,160 objects) load in about 2 seconds of CPU, and `LargeModelLoadTest`
holds that to a budget. Java and Kotlin.
- **`gen <Entity>` no longer shrinks the files rendered from the whole model.** Narrowing a run
to some entities (`meta gen Post`, Python `metaobjects gen --entities Post`) handed every
generator only the named entities, so a whole-model file (the TypeScript barrel and Cube
model, Python's shared enums module, duration codec and report writers, and the object index
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,
and every whole-model file it writes is byte-identical to a full run's. A generator sees the
whole model in `ctx.entities` and the narrowing as `ctx.selected`; `perEntity` (`per_entity`)
applies it. A Python target's declared `entities` still bounds that target's model. C# and
Java take no entity filter and were not affected. Two consequences to expect: a narrowed run
applies it. A Python target's declared `entities` still bounds that target's model. The C# and
Maven entity selection added in this release follows the same rule. Two consequences to expect: a narrowed run
checks the whole model as a full run does (a sourced object with no `dialect`, colliding
collection names), because the files it writes are rendered from it; and an owned generator
that writes one file per object by looping over `ctx.entities` itself, instead of through
Expand Down
7 changes: 5 additions & 2 deletions docs/features/metadata-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,11 @@ the snapshots first under `dep:<name>/<artifact>` source ids. It never writes ei
POCO of a *value object* (and the shared enums it uses) that a generated type reaches — an entity
or local value object that holds it, or a local template whose `@payloadRef` / `@responseRef` names
it — because that generated type needs it to compile. `inScope` is Python's formula (no `matchesScope` on the
project's own objects), and C# has no entity-name positional on `gen`, so the TypeScript
"refuse an explicitly named imported object" check has no C# surface. Known edge: a local entity
project's own objects). `dotnet meta gen --entities` resolves names against the in-scope
objects only, so naming an excluded import is refused the way TypeScript's "refuse an
explicitly named imported object" check refuses it (exit 2, `--entities names 'X', which
matches no object in the metadata.` — C#'s wording, not TypeScript's imported-specific
message). Known edge: a local entity
that `extends` an imported concrete entity in a table-per-hierarchy mapping is not specially handled.

## Vendoring vs. depending
Expand Down
9 changes: 6 additions & 3 deletions docs/features/own-your-codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ handles those files by one rule:

- **Only a full run cleans up.** A run of the project's whole generator list decides; a run
narrowed to some generators (`--generators`), to some entities (`meta gen <Entity>`,
`metaobjects gen --entities`), or to a target that shares its directory with a target left
`metaobjects gen --entities`, `dotnet meta gen --entities`, Maven `-Dmeta.entities`), or to
a target that shares its directory with a target left
out, deletes nothing, because the files of the part it skipped would all look stale. So
does `--baseline=adopt`, which writes nothing by definition.
- **A candidate is a file the manifest says `gen` wrote.** It lies under an output directory
Expand All @@ -614,8 +615,10 @@ handles those files by one rule:
that name is not mistaken for generated output.
- **A dry run** (`meta gen --dry-run`) reports what it would remove and removes nothing.

On **Java and Kotlin** every `mvn metaobjects:generate` execution is a full run, since its
`<generators>` list is always complete. Every manifest entry names its owner: the generator's
On **Java and Kotlin** every `mvn metaobjects:generate` execution runs the whole
`<generators>` list, since there is no `--generators` narrowing; a run narrowed by
`meta.entities` is the one exception, and it deletes no orphaned file (see
[Select objects](../ports/java.md#generate) on the Java page). Every manifest entry names its owner: the generator's
registry id and its output directory within the module, not the Maven execution, so
`default-cli`, a renamed execution and the lifecycle execution agree. A recorded file no
generator emitted in this build is an orphan when this run's own generators own it, or when
Expand Down
15 changes: 15 additions & 0 deletions docs/ports/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,21 @@ reference their output; `gen` warns when one is missing from the list, since the
would not compile. `--generators <names>` narrows a run to the declared entries named; it
never adds one, and naming an entry the list does not declare is refused.

**Select objects.** `dotnet meta gen --entities Product,Supplier` (comma-separated short object
names, the `name` of the object without its package, as TypeScript's positional names and
Python's `--entities` match) regenerates only those objects' files; `dotnet meta verify --codegen
--entities ...` checks only the same files. Only per-object output narrows. A file built from
the whole model, such as `AppDbContext.g.cs`, still renders from the whole model and is
byte-identical to an unfiltered run, and a shared file (a shared enum, a helper) is the
whole-model rendering too. A generator that reads the model root rather than the object list
(`api-docs`, `requirement-tests`, template entries) is not narrowed. A narrowed run never
deletes a stale file and never drops the manifest entry of a file it did not write, so the
unselected objects' files are left as they are; run `gen` without the flag to sweep. Two
refusals, both exit 2: `--entities` naming nothing (`error: dotnet meta gen: --entities names no
object.`) and a name that matches no object (`error: dotnet meta gen: --entities names 'X',
which matches no object in the metadata.`). An owned generator whose output is a single
whole-model file declares `public bool WholeModel => true;`.

**Own a generator.** `dotnet meta eject <name>...` copies a reference generator into
`codegen/generators/`. Every generator `dotnet meta gen --list` shows is ejectable except
`template`, the Mustache primitive, which has no emit logic of its own to own. An ejected
Expand Down
21 changes: 21 additions & 0 deletions docs/ports/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,27 @@ mvn metaobjects:generate # or run it alone
The generators write the DTO records, the Spring controller, the repository and the filter
allowlist under `target/generated-sources/java`, which Maven compiles with your code.

**Select objects.** `mvn metaobjects:generate -Dmeta.entities=Program,Week` (or
`<entities>Program,Week</entities>` in the plugin `<configuration>`) regenerates only those
objects' files: comma-separated short object names, the selection TypeScript's
`meta gen Program Week` and the `--entities` flag in Python and C# make. Only per-object output
narrows. A file built from the whole model (a validator registry, the report export writer,
the class-binding provider, a package's wire support classes) still renders from the whole model
and is byte-identical to an unnarrowed run. A narrowed run deletes no orphaned file and keeps
the manifest entry of every file it did not write; run without the property to sweep. Two
refusals fail the goal: a blank selection (`mvn metaobjects:generate: meta.entities names no
object.`) and a name that matches no object (`... meta.entities names 'X', which matches no
object in the metadata.`). Each generator's `<filters>` apply on top. Unlike the selection, a
generator's `<filters>` narrow its whole-model files too, since they configure that generator.
Through 8.2.x the `codegen-spring` and `codegen-kotlin` generators ignored `<filters>`; from
8.3.0 they honour them, so a pom whose filters were inert now generates less.

**Large models.** The loader gives initialization 30 seconds by default. A model large enough
to need longer sets `-Dmeta.loaderTimeoutMs=120000` (or `<loaderTimeoutMs>` in the plugin
`<configuration>`). Outside Maven, the same setting is `LoaderOptions.setInitTimeoutMs`, the
loader argument `initTimeoutMs`, or the system property `metaobjects.loader.initTimeoutMs`.
The timeout error names all three.

## Verify

```bash
Expand Down
6 changes: 6 additions & 0 deletions docs/ports/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ mvn metaobjects:generate # or run the codegen alone
mvn metaobjects:verify # fails, naming the files, when generated code is stale against the model
```

`-Dmeta.entities=Program,Week` regenerates only those objects' files, and each generator's
`<filters>` narrow what it writes; `-Dmeta.loaderTimeoutMs` raises the loader's 30-second
initialization timeout for a large model. Both are the Maven plugin's, shared with Java: see
[Select objects](java.md#generate) on the Java page for what narrows, what stays whole-model,
and the refusals.

Schema migrations are owned by the TypeScript toolchain — see the
[Migrations section](../features/migrations-and-drift.md#kotlin) for the `meta migrate` commands.

Expand Down
11 changes: 11 additions & 0 deletions docs/ports/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ config is refused. Column naming is not a Python setting at all: it is `naming`
([physical-naming.md](../features/migrations/physical-naming.md)). See [the migration section](../features/migrations/docs-are-generators.md#python)
and the [config reference](../features/cli.md).

**Select objects.** `metaobjects gen --entities Program,Week` (comma-separated short object
names) regenerates only those objects' files; a target that lists `entities` keeps only the
names in both. `metaobjects verify --codegen --entities ...` checks the same files. A narrowed
run deletes no orphaned file; run without the flag to sweep. Two refusals, both exit 2:
`--entities` naming nothing (`error: metaobjects gen: --entities names no object.`) and a
name that matches no object (`error: metaobjects gen: --entities names 'X', which matches no
object in the metadata.`). The same selection is a positional name list in TypeScript
(`meta gen Program Week`), `--entities` in C#, and `-Dmeta.entities` on the Maven plugin.
`gen` lists the files it changed and counts the rest separately
(`metaobjects gen: wrote 2 file(s) across 1 target(s). 40 file(s) left as they were.`).

**Start a project.** `metaobjects init` writes `metaobjects.config.yaml` (one `app` target
with no generators) and an empty, loadable `metaobjects/meta.app.yaml`, and reports what it
wrote. It never overwrites a file it finds; it says it kept it. `metaobjects init --with-docs`
Expand Down
6 changes: 6 additions & 0 deletions docs/ports/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ meta verify --codegen # committed output, docs included, vs a fresh regen
meta verify --db <url> # live DB schema vs metadata
```

`meta gen Author Post` names objects by their short name (without the package). Each
generator's `filter` option applies on top. A name that matches no object is refused with
exit 2 before anything is written, even beside names that match (`meta gen: names 'Ordr',
which matches no object in the metadata.`). Every port has the same selection: `--entities` in Python and C#,
`-Dmeta.entities` on the Maven plugin for Java and Kotlin.

### Schema — first migration on a brand-new database

`meta migrate` diffs your metadata against a **committed schema snapshot**,
Expand Down
Loading
Loading