Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface inheritance is translated incorrectly #34

Open
marcoqu opened this issue May 21, 2018 · 2 comments
Open

Interface inheritance is translated incorrectly #34

marcoqu opened this issue May 21, 2018 · 2 comments
Assignees
Labels

Comments

@marcoqu
Copy link

marcoqu commented May 21, 2018

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

@mrix mrix self-assigned this May 22, 2018
@mrix mrix added the bug label May 22, 2018
@mrix
Copy link
Member

mrix commented May 22, 2018

Hi @marcoqu. The solution provided by #35 should partly fix this bug. The only problem left is additionalProperties: false overriding for named definitions:

Accoriding to the specification:

Any members other than "$ref" in a JSON Reference object SHALL be ignored.

Possible solutions are still being discussed:

@marcoqu
Copy link
Author

marcoqu commented May 23, 2018

Hi @mrix, Thanks about this!
I see that in the huge Vega Lite pull request they also seem to have approached the same issue.
Is that pull request (or elements of it) going to get merged or have they become two different, incompatible projects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants