-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: schema generation when property name cannot be escaped (#2018)
Co-authored-by: Bence Balogh <bence.balogh@ingenimind.com>
- Loading branch information
1 parent
840ac08
commit b1722e1
Showing
4 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Class props has only implicit types! | ||
export class MyClass { | ||
PROP_1 = ''; | ||
"PROP_2" = ''; | ||
"PROP.3" = ''; | ||
"{PROP_4}" = ''; | ||
"400" = ''; | ||
500 = ''; | ||
'' = ''; | ||
CHILD = { | ||
PROP_1: '', | ||
"PROP_2": '', | ||
"PROP.3": '', | ||
"{PROP_4}": '', | ||
"400": '', | ||
500: '', | ||
'': '', | ||
}; | ||
} | ||
|
||
export interface MyInterface { | ||
PROP_1: string; | ||
"PROP_2": string; | ||
"PROP.3": string; | ||
"{PROP_4}": string; | ||
"400": string; | ||
500: string; | ||
'': string; | ||
CHILD : { | ||
PROP_1: string, | ||
"PROP_2": string, | ||
"PROP.3": string, | ||
"{PROP_4}": string, | ||
"400": string, | ||
500: string, | ||
'': string | ||
}; | ||
} |
151 changes: 151 additions & 0 deletions
151
test/valid-data/string-literal-property-names/schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MyClass": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"": { | ||
"type": "string" | ||
}, | ||
"400": { | ||
"type": "string" | ||
}, | ||
"500": { | ||
"type": "string" | ||
}, | ||
"CHILD": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"": { | ||
"type": "string" | ||
}, | ||
"400": { | ||
"type": "string" | ||
}, | ||
"500": { | ||
"type": "string" | ||
}, | ||
"PROP.3": { | ||
"type": "string" | ||
}, | ||
"PROP_1": { | ||
"type": "string" | ||
}, | ||
"PROP_2": { | ||
"type": "string" | ||
}, | ||
"{PROP_4}": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"PROP_1", | ||
"PROP_2", | ||
"PROP.3", | ||
"{PROP_4}", | ||
"400", | ||
"500", | ||
"" | ||
], | ||
"type": "object" | ||
}, | ||
"PROP.3": { | ||
"type": "string" | ||
}, | ||
"PROP_1": { | ||
"type": "string" | ||
}, | ||
"PROP_2": { | ||
"type": "string" | ||
}, | ||
"{PROP_4}": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"PROP_1", | ||
"PROP_2", | ||
"PROP.3", | ||
"{PROP_4}", | ||
"400", | ||
"500", | ||
"", | ||
"CHILD" | ||
], | ||
"type": "object" | ||
}, | ||
"MyInterface": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"": { | ||
"type": "string" | ||
}, | ||
"400": { | ||
"type": "string" | ||
}, | ||
"500": { | ||
"type": "string" | ||
}, | ||
"CHILD": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"": { | ||
"type": "string" | ||
}, | ||
"400": { | ||
"type": "string" | ||
}, | ||
"500": { | ||
"type": "string" | ||
}, | ||
"PROP.3": { | ||
"type": "string" | ||
}, | ||
"PROP_1": { | ||
"type": "string" | ||
}, | ||
"PROP_2": { | ||
"type": "string" | ||
}, | ||
"{PROP_4}": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"PROP_1", | ||
"PROP_2", | ||
"PROP.3", | ||
"{PROP_4}", | ||
"400", | ||
"500", | ||
"" | ||
], | ||
"type": "object" | ||
}, | ||
"PROP.3": { | ||
"type": "string" | ||
}, | ||
"PROP_1": { | ||
"type": "string" | ||
}, | ||
"PROP_2": { | ||
"type": "string" | ||
}, | ||
"{PROP_4}": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"PROP_1", | ||
"PROP_2", | ||
"PROP.3", | ||
"{PROP_4}", | ||
"400", | ||
"500", | ||
"", | ||
"CHILD" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |