With the release of 2.1.0, I started seeing schema validation errors.
Below is an example where a field in an interface could be a string or a RegExp. Before 2.1, this worked because the generated just dropped the RegExp class.
Given the following interface:
export interface PatternAdjustment {
/** Id of the Adjustment, i.e. `short-compound` */
id: string;
/** RegExp pattern to match */
regexp: string | RegExp;
/** The amount of penalty to apply. */
penalty: number;
}
Output: v2.1.1
"PatternAdjustment": {
"additionalProperties": false,
"properties": {
"id": {
"description": "Id of the Adjustment, i.e. `short-compound`",
"markdownDescription": "Id of the Adjustment, i.e. `short-compound`",
"type": "string"
},
"penalty": {
"description": "The amount of penalty to apply.",
"markdownDescription": "The amount of penalty to apply.",
"type": "number"
},
"regexp": {
"anyOf": [
{
"type": "string"
},
{
"format": "regex", <-- Unknown format
"type": "string"
}
],
"description": "RegExp pattern to match",
"markdownDescription": "RegExp pattern to match"
}
},
"required": [
"id",
"regexp",
"penalty"
],
"type": "object"
},
Output: v2.0.1
"PatternAdjustment": {
"additionalProperties": false,
"properties": {
"id": {
"description": "Id of the Adjustment, i.e. `short-compound`",
"markdownDescription": "Id of the Adjustment, i.e. `short-compound`",
"type": "string"
},
"penalty": {
"description": "The amount of penalty to apply.",
"markdownDescription": "The amount of penalty to apply.",
"type": "number"
},
"regexp": {
"description": "RegExp pattern to match",
"markdownDescription": "RegExp pattern to match",
"type": "string"
}
},
"required": [
"id",
"regexp",
"penalty"
],
"type": "object"
},
I'm going to try to work around this by creating a new type and using @hidden.
Related to: #1921, #1927, and #1930
With the release of 2.1.0, I started seeing schema validation errors.
Below is an example where a field in an interface could be a string or a
RegExp
. Before 2.1, this worked because the generated just dropped theRegExp
class.Given the following
interface
:Output: v2.1.1
Output: v2.0.1
I'm going to try to work around this by creating a new type and using
@hidden
.