Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JsonSchemaExporter interaction with byte[] #130869

Copy link
Copy link

Description

@Youssef1313
Issue body actions

Description

Schema for byte[] should produce "contentEncoding": "base64"

https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-01#section-8.3

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));

Expected behavior

contentEncoding is emitted and set to base64.

Actual behavior

{
  "type": [
    "string",
    "null"
  ]
}

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Reactions are currently unavailable

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.