Closed
Description
Consider this schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [ { "$ref": "https://example.com" } ],
"title": "Foo"
}
The unnecessary_allof_ref_wrapper
linter rule will DELETE allOf
and ASSIGN $ref
, resulting in $ref
getting AFTER allOf
, like this:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Foo",
"$ref": "https://example.com"
}
Whereas its cleaner to modify the allOf
in place and end up with a schema like this:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "https://example.com",
"title": "Foo"
}
Another case is this schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{ "$ref": "https://example.com" },
{ "type": "string" }
],
"title": "Foo"
}
Which will end up as:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{ "type": "string" }
],
"title": "Foo",
"$ref": "https://example.com",
}
Whereas ideally it ends up as:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "https://example.com",
"allOf": [
{ "type": "string" }
],
"title": "Foo"
}
Metadata
Metadata
Assignees
Labels
No labels