Skip to content

[.NET] Fix the things schema for schema registry#1236

Merged
timtay-microsoft merged 3 commits intomainfrom
timtay/test4
Feb 19, 2026
Merged

[.NET] Fix the things schema for schema registry#1236
timtay-microsoft merged 3 commits intomainfrom
timtay/test4

Conversation

@timtay-microsoft
Copy link
Member

@timtay-microsoft timtay-microsoft commented Feb 19, 2026

As seen here before the recent DTDL -> WoT conversion, the behavior of the schema registry generated classes was to define error types like

        [JsonPropertyName("error")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public SchemaRegistryError? Error { get; set; } = default;

But recent WoT changes made the same fields get defined like

        [JsonPropertyName("getError")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public SchemaRegistryError? GetError { get; set; } = default;

which would break deserialization of errors sent from the schema registry service.

This change alters the SchemaNames.json file such that running code gen gives the expected output on fields like the above. Then codegen was run on this branch.

See also #1229 for this same SchemaNames.json file change since it is needed in Rust as well.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the WoT schema naming rules for Schema Registry so generated .NET response types deserialize service error payloads correctly (restoring the pre-WoT behavior where the error field is named error).

Changes:

  • Update Schema Registry SchemaNames.json to emit the action response error field name as error.
  • Regenerate/update .NET Schema Registry response schemas to use [JsonPropertyName("error")] and an Error property.
  • Update the generated Schema Registry client stub logic to read/write the new Error property.

Reviewed changes

Copilot reviewed 1 out of 4 changed files in this pull request and generated no comments.

File Description
eng/wot/schemaregistry/SchemaNames.json Changes action response error field naming rule to output error.
dotnet/src/Azure.Iot.Operations.Services/SchemaRegistry/Generated/SchemaRegistry.g.cs Updates generated client logic to set/check Response.Error instead of action-specific error properties.
dotnet/src/Azure.Iot.Operations.Services/SchemaRegistry/Generated/PutResponseSchema.g.cs Renames error field mapping to [JsonPropertyName("error")] with Error property.
dotnet/src/Azure.Iot.Operations.Services/SchemaRegistry/Generated/GetResponseSchema.g.cs Renames error field mapping to [JsonPropertyName("error")] with Error property.

@timtay-microsoft timtay-microsoft merged commit 4b15b4f into main Feb 19, 2026
19 checks passed
@timtay-microsoft timtay-microsoft deleted the timtay/test4 branch February 19, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants