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
C# 11 added a required member and starting in .NET8, System.Text.Json now has full support for deserializing required members, giving an error if the member is missing. The compiler creates a System.Runtime.CompilerServices.RequiredMemberAttribute so JsonSchemaGenerator should check for this attribute in addition to the other required attributes.
I was able to temporarily support this by the following custom schema processor, but it is slightly hacky. I couldn't find a way of determining the final json property name from the Namotion ContextualPropertyInfo, is there one? I instead just re-looked up the JsonName attribute (only a few properties in our codebase have that name attribute, most are just named directly). Also, I had another hack to determine if it was a derived type by looking at AllOf... but it works for our schema.
C# 11 added a required member and starting in .NET8, System.Text.Json now has full support for deserializing required members, giving an error if the member is missing. The compiler creates a System.Runtime.CompilerServices.RequiredMemberAttribute so JsonSchemaGenerator should check for this attribute in addition to the other required attributes.
I was able to temporarily support this by the following custom schema processor, but it is slightly hacky. I couldn't find a way of determining the final json property name from the Namotion ContextualPropertyInfo, is there one? I instead just re-looked up the JsonName attribute (only a few properties in our codebase have that name attribute, most are just named directly). Also, I had another hack to determine if it was a derived type by looking at AllOf... but it works for our schema.
The text was updated successfully, but these errors were encountered: