Skip to content

v11.6.2

Latest

Choose a tag to compare

@RicoSuter RicoSuter released this 11 Nov 14:37
· 1 commit to master since this release
a2e3af5

⚠️ Behaviour changes

Swagger2 schema output changes with default settings (#1931). Properties that are both required and nullable now emit x-nullable: true instead of silently losing their declared nullability. This applies when generating SchemaType.Swagger2 documents and the property is marked required by a presence-only marker — the C# required keyword, [JsonRequired], [DataMember(IsRequired = true)], or Newtonsoft Required.AllowNull. Properties marked with [Required] from DataAnnotations are unaffected. Downstream, C# clients generated from such documents may now produce nullable types where they previously produced non-nullable ones.

Generated C# changes when UseRequiredKeyword = true (#1926). Previously this setting suppressed default-value and = default! initializers on all properties. It now suppresses them only on properties that actually receive the required keyword, so optional properties regain their initializers. The required keyword itself is still emitted on exactly the same properties. Users on the default (UseRequiredKeyword = false) see no change.

New settings

  • CSharpGeneratorSettings.IntegerType (default "int") — maps unformatted integer properties to a custom .NET type. Explicit formats (byte, int32, int64/long, uint64/ulong) and min/max-driven long widening still take precedence. (#1889)
  • CSharpGeneratorSettings.AdditionalPropertiesValueType (default "object") — controls the value type of the generated extension-data dictionary. (#1936)
  • CSharpGeneratorSettings.PropertyAttributeFactory and the new IPropertyAttributeFactory interface (default null) — renders custom attributes on generated properties. (#1938)

What's Changed

  • Add IntegerType setting to CSharpGeneratorSettings by @lahma with @Copilot in #1889
  • chore: Clarify required-marker logic and strengthen MinLength assertions by @RicoSuter in #1923
  • Only skip default value initialization for required properties when UseRequiredKeyword is enabled by @BenHewins in #1926
  • docs: add general pull request template by @RicoSuter in #1940
  • Add CSharp generator param for extensions data value type by @zaigr in #1936
  • Add IPropertyAttributeFactory to allow custom attributes on generated C# properties by @mingyaulee in #1938
  • Emit x-nullable for required nullable properties in Swagger2 by @raeffs in #1931

New Contributors

Full Changelog: v11.6.1...v11.6.2