Skip to content

10.2.0

Latest

Choose a tag to compare

@pokornyd pokornyd released this 05 May 13:50
· 1 commit to master since this release

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

  • --nullability flag — controls how element properties express nullability. The default strict keeps every property nullable (string?, RichTextContent?, IEnumerable<Asset>?), matching previous behavior. The new semantic mode 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 enable directive 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.RequiresDefaultInitializer is now [Obsolete] — replaced by Property.HasInitializer (and the new Property.Initializer expression). Only relevant if you consume Kontent.Ai.ModelGenerator.Core as 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