Skip to content

Kontent.Ai.ModelGenerator 11.0.0-rc.2

Pre-release
Pre-release

Choose a tag to compare

Fixed

  • The tool no longer ships the Visual Basic compiler. Microsoft.CodeAnalysis is the meta-package; only the C# syntax and workspace formatting APIs are used, so it now references Microsoft.CodeAnalysis.CSharp.Workspaces directly.

  • A blank comment argument reports ArgumentException rather than ArgumentNullException. The value is present, just empty — the two are different mistakes, and the tests had frozen the wrong one.

  • Generated members are ordered ordinally rather than by the current culture, so the same content model produces the same file on every machine.

  • appSettings.json names the option the tool actually reads. It still listed BaseClass, which was renamed to BaseRecord.

  • The startup banner no longer reports success before anything is generated. A failed run's first line was "Models were generated for …"; it now says what it is about to do.

  • IClassCodeGeneratorFactory covers both emitters. It offered only the Delivery generator while the Management path constructed its own directly — a seam that looked like the way in and was not. It now has a method per emitter, and the Management path goes through it.

  • The config-file documentation matches where the tool actually looks. The README described appSettings.json as living beside the executable; the tool reads it from the working directory, and as a dotnet tool it has no executable directory to speak of. The file is also not installed with the tool, so the README now points at it as a template to copy.

  • Management mode no longer skips elements over identifiers it never emits. Every content type reserved the names the Delivery emitter uses for its codename constants — {Property}Codename for each element, plus the type's own ContentTypeCodename — regardless of mode. The Management emitter writes none of those, so the reservation only rejected valid input there: a type carrying both title and title_codename had the second skipped with a collision warning, and an element codenamed content_type_codename was renamed for no reason. Constant registration is now the Delivery emitter's, so Management mode has the whole identifier space its own output uses.

  • --baseRecord is rejected at startup when it is not a valid C# record name. -b "My-Base" wrote public partial record My-Base and an extender deriving every generated model from it, so the whole output failed to compile over one argument. The name is checked before any API call and reported like any other configuration problem.

  • Forgetting --management now fails instead of generating Delivery models. Validation accepted the union of both modes' parameters while binding only ever applied the active mode's, so -k (or --apiKey) without -m was accepted, dropped, and the run continued as a full Delivery generation - writing Delivery models over whatever was in the output directory and exiting 0. The reverse dropped the Delivery-only -p / --projectid in Management mode and then failed with a message about an empty EnvironmentId, which read as a configuration problem rather than a wrong flag. Each argument is now checked against the mode that is actually running, and one that belongs to the other mode names the mode switch:

    -k configures the Management API. Add --management (or -m) to generate from it.
    

    The same check now covers the section-qualified form (--ManagementOptions:ApiKey without --management, and --DeliveryOptions:* with it), which bound straight into configuration without needing a switch mapping and so slipped past the mode entirely. Only command-line arguments are checked - an appSettings.json carrying both sections is unaffected, and the section belonging to the mode you run is the one that is read.

  • --nullability is refused in Management mode instead of accepted and ignored. It selects how generated Delivery models express nullability. Management models are uniformly nullable by contract - a null property is omitted from the upsert payload, which is how you leave an element untouched - so there was never anything for the flag to select there. The parameter table already documented it as Delivery-only; now the tool enforces it.

  • --management together with --baseRecord no longer emits code that cannot compile. The generated base record and its extender both carried a hardcoded using Kontent.Ai.Delivery.Abstractions;. A project generated for the Management SDK has no reason to reference the Delivery SDK, so that line was a CS0246 in a file the consumer never wrote. Neither it nor the using System; beside it was referenced by the emitted code in either mode; both are gone.

Installation

dotnet add package Kontent.Ai.ModelGenerator --prerelease

Full changelog: src/model-generator/CHANGELOG.md