You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PSM JSON serializers write null for optional references the OpenAPI document does not make nullable #425
The generated PSM JSON serializers write null for an optional reference property that is not set, where the OpenAPI document (Resources/ptc-25-02-30.json) declares that property as an Identified object that is not nullable. A conforming request leaves the property out instead.
Example, SysML2.NET.Serializer.Json/PSM/AutoGenSerializer/ProjectRequestSerializer.cs:88:
So new ProjectRequest { Name = "p" } is sent as {"@type":"Project","defaultBranch":null,…}, which does not validate against ProjectRequest.
Affected request types
Optional, non-nullable properties for which the serializer writes null:
Request
Properties
DataVersionRequest
identity
ExternalRelationshipRequest
elementEnd, externalDataEnd
PrimitiveConstraintRequest
inverse
ProjectRequest
defaultBranch
ProjectUsageRequest
usedCommit, usedProject
The serializers are generated from SysML2.NET.CodeGenerator/Templates/OpenAPI/psm-json-serializer-openapi-template.hbs; the fix belongs in the template: omit an unset property unless its schema allows null.
How it was found
The Flexo integration scenario of #407 checks every request against the OpenAPI document. POST /projects (step 2) fails that check:
POST /projects: SchemaMismatch: /defaultBranch type: Value is "null" but should be "object"
Activity
Fix #425
[Update] Flexo integration scenario: drop the #428 workaround in Mode…