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
JsonSchemaExporter interaction with byte[] #130869
I think this is how STJ handles byte[] when serializing/deserializing.
Reproduction Steps
var x = new JsonSerializerOptions();
x.WriteIndented = true;
x.TypeInfoResolver = JsonSerializerOptions.Default.TypeInfoResolver;
Console.WriteLine(JsonSchemaExporter.GetJsonSchemaAsNode(x, typeof(byte[])).ToJsonString(x));
We haven't been applying the contentEncoding keyword elsewhere. Are there other primitive types (e.g. DateTimeOffset, Guid, Uri, etc) that should also apply it?
Activity
dotnet-policy-service commentedon Jul 16, 2026
Tagging subscribers to this area: @dotnet/area-system-text-json
See info in area-owners.md if you want to be subscribed.
eiriktsarpalis commentedon Jul 16, 2026
We haven't been applying the
contentEncodingkeyword elsewhere. Are there other primitive types (e.g.DateTimeOffset,Guid,Uri, etc) that should also apply it?Youssef1313 commentedon Jul 16, 2026
Apart from
byte[],Memory<byte>, andReadOnlyMemory<byte>, I'm not aware of anything else that needs specialcontentEncodinghandling. I think date/time, guid, uri all end up informatwhich is already handled per https://json-schema.org/draft/2020-12/json-schema-validation#section-7.3eiriktsarpalis commentedon Jul 16, 2026
Ok -- care to file a PR?
Youssef1313 commentedon Jul 16, 2026
Sure, assigned to Copilot with instructions. I think the right place to do this is by overriding CreateSchema in the relevant json converters.