-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Issue Description
Yaml->Ts Generator miss minLength=0 from Yaml Def and generate wrong types (just string instead of WithinRangeString)
Current Behavior
Yaml Source:
EmptyString:
type: string
minLength: 0
maxLength: 0
LimitedString:
type: string
minLength: 0
maxLength: 4000
Ts Output:
export type EmptyString = t.TypeOf<typeof EmptyString>;
export const EmptyString = t.string;
export type LimitedString= t.TypeOf<typeof LimitedString>;
export const LimitedString= t.string;
Expected/Correct Behavior
Ts Output:
export type EmptyString = t.TypeOf<typeof EmptyString>;
export const EmptyString = WithinRangeString(0, 1);
export type LimitedString= t.TypeOf<typeof LimitedString>;
export const LimitedString= WithinRangeString(0, 4001);
Solution:
Into macros.njk file, change
{% elif definition.minLength and definition.maxLength %}
TO
{% elif definition.minLength!==undefined and definition.maxLength!==undefined %}
In this way, 0
value will be recognized and used
Metadata
Metadata
Assignees
Labels
No labels