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
Upgrading from 1.0.0 to 1.1.0 causes "additionalProperties": false
to be dropped.
#1416
Comments
I'll take a looks at the cause, but maybe you have an idea why |
Good catch. Thanks for looking into it. I can make a new release when we have a fix. |
@Jason3S I am currently a bit short on time, but I can take a look if you provide a minimal example. |
I found the cause and have a quick fix. But, there might be some improvement. Cause: Hidden types become NeverType and
When combined with other types, ts-json-schema-generator/src/Utils/allOfDefinition.ts Lines 87 to 92 in 065ac27
Possible fix: if (
(other.additionalProperties || other.additionalProperties === undefined) &&
definition.additionalProperties == false &&
!(baseType instanceof NeverType)
) {
delete definition.additionalProperties;
} But a better fix might be to make a export class HiddenTypeFormatter implements SubTypeFormatter {
public supportsType(type: HiddenType): boolean {
return type instanceof HiddenType;
}
public getDefinition(type: HiddenType): Definition {
return { not: {}, additionalProperties: false };
}
public getChildren(type: HiddenType): BaseType[] {
return [];
}
} |
@Jason3S Nice find, personally I think it makes sense to introduce a |
fix: vega#1416 - Add HiddenType - Add HiddenTypeFormatter - Add test
fix: vega#1416 - Add HiddenType - Add HiddenTypeFormatter - Add test
Thank you for releasing 1.1.1. |
Thanks for the fix |
This is a preliminary report.
I'll investigate further to provide a simple repo case.
Using
git bisect
, the issue started with #1367The text was updated successfully, but these errors were encountered: