You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #290 the const keyword is supported and acts as an alias for an enum with one value. This is great but it does not work correctly for a const that contains an empty string. Example:
Input:
"foo": {
"const": ""
}
Expected output:
foo: ""
Actual output:
foo: {
[k: string]: unknown;
};
An enum containing a single value of an empty string does work as expected:
"foo": {
"enum": [
""
]
}
What use is a const with an empty string?
I use these for fields where the value is required and always a string but can be empty, for example an optional URL. Of course it should be nullable/optional really but this is a legacy application.
Since #290 the
const
keyword is supported and acts as an alias for anenum
with one value. This is great but it does not work correctly for a const that contains an empty string. Example:Input:
Expected output:
Actual output:
An enum containing a single value of an empty string does work as expected:
What use is a const with an empty string?
I use these for fields where the value is required and always a string but can be empty, for example an optional URL. Of course it should be nullable/optional really but this is a legacy application.
The text was updated successfully, but these errors were encountered: