Kontent.ai model generator for .NET 10.2.0
This is a minor release that adds an opt-in --nullability semantic mode for generating non-nullable element properties with sensible defaults, and emits #nullable enable on every generated content type record.
For details on the 10.1.1 changes, see the 10.1.1 release notes.
New features
--nullabilityflag — controls how element properties express nullability. The defaultstrictkeeps every property nullable (string?,RichTextContent?,IEnumerable<Asset>?), matching previous behavior. The newsemanticmode matches the runtime semantics of the Delivery API: text, rich text, and collection elements always come back populated, so they're emitted as non-nullable with default initializers (= string.Empty,= RichTextContent.Empty,= []). Numbers, dates, and custom elements remain nullable. See Nullability mode for tradeoffs (notably with projection).#nullable enabledirective in generated content type records — generated record files now open with#nullable enable, so the?annotations are honored regardless of the consuming project's nullability context. Projects without a project-wide nullable context no longer warn (CS8632) on the generated annotations.
Important
This version requires you to bump delivery SDK to at least version 19.2.0, which introduced RichTextContent.Empty.
Deprecations
Property.RequiresDefaultInitializeris now[Obsolete]— replaced byProperty.HasInitializer(and the newProperty.Initializerexpression). Only relevant if you consumeKontent.Ai.ModelGenerator.Coreas a library; the CLI is unaffected.
Looking ahead
--nullability semantic will become the default in the next major version. If your code branches on null to detect projection-omitted elements (WithElements / WithoutElements), pin --nullability strict explicitly when you upgrade to keep that distinction in the type system.
What's Changed
Full Changelog: 10.1.1...10.2.0