Skip to content

Commit c619fbe

Browse files
committed
Use blueprint isOptional/isNullable for model property nullability
The blueprint now exposes `isOptional` and `isNullable` on properties. Map them to the two orthogonal C# concepts instead of emitting every model property as optional+nullable: - DataMember IsRequired = !isOptional (payload presence) - C# nullable annotation = isNullable (value may be null) Endpoint parameters are unchanged (they carry isRequired). Bump @seamapi/blueprint to ^0.60.0. The generated output is regenerated and formatted by the Generate CI workflow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ThCbfBhJb4Hydvo8Es4qJA
1 parent 3c3691c commit c619fbe

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

codegen/lib/build-model.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,14 @@ const normalizeItemKind = (property: Property): Kind => {
158158
}
159159

160160
const normalizeProperty = (property: Property): Field => {
161-
// Resource properties do not carry required/nullable metadata; every model
162-
// property is emitted as optional and nullable so response deserialization
163-
// never fails on a missing or added field.
164-
const base = { name: property.name, isRequired: false, nullable: true }
161+
// `isOptional` controls whether the property must be present in the payload
162+
// (the DataMember IsRequired flag); `isNullable` controls whether its value
163+
// may be null (the C# nullable annotation). The two are independent.
164+
const base = {
165+
name: property.name,
166+
isRequired: !property.isOptional,
167+
nullable: property.isNullable,
168+
}
165169
switch (property.format) {
166170
case 'string':
167171
case 'id':

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"npm": ">=10.9.4"
5959
},
6060
"devDependencies": {
61-
"@seamapi/blueprint": "^0.59.0",
61+
"@seamapi/blueprint": "^0.60.0",
6262
"@seamapi/smith": "^0.5.2",
6363
"@seamapi/types": "1.970.0",
6464
"@types/node": "^24.10.9",

0 commit comments

Comments
 (0)