Skip to content

Interface inheritance is translated incorrectly #34

Open
@marcoqu

Description

@marcoqu

In cases of interface inheritance, the generated json schema joins the two definitions with allOf.
However, when the definitions have "additionalProperties": false the generated schema is incorrect.

A possible workaround, is having "additionalProperties": true for both the extended and the extending interface (but this would allow also for other properties).

Test case:

interface Example extends BaseExample {
    exampleProperty: string;
}

interface BaseExample {
    baseExampleProperty: number;
}

Error:

Property baseExampleProperty is not allowed.
Property exampleProperty is not allowed.

More about the issue:
json-schema-org/json-schema-spec#348
https://spacetelescope.github.io/understanding-json-schema/reference/combining.html

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions