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
When generating for objects that have patternProperties with the strictIndexSignatures option, json-schema-to-typescript does not honor the strictIndexSignatures option.
Where it returns the keyName as [k: string] in the singlePatternProperty case but doesn't update the keyName property of the ast, which is used by the strictIndexSignatures routine:
exportinterfaceExperiment{maybe?: string;pattern?: {maybe?: string;/** * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` "leaf|tree". */[k: string]: unknown[]|undefined;};[k: string]: unknown|undefined;}
Actual output
exportinterfaceExperiment{maybe?: string;pattern?: {maybe?: string;/** * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` "leaf|tree". */[k: string]: unknown[];};[k: string]: unknown|undefined;}
When generating for objects that have
patternProperties
with thestrictIndexSignatures
option,json-schema-to-typescript
does not honor thestrictIndexSignatures
option.I traced this down to this area of code:
json-schema-to-typescript/src/parser.ts
Lines 407 to 427 in c826963
Where it returns the
keyName
as[k: string]
in thesinglePatternProperty
case but doesn't update thekeyName
property of theast
, which is used by thestrictIndexSignatures
routine:json-schema-to-typescript/src/generator.ts
Lines 156 to 158 in c826963
I attempted a fix in this PR, here: #560
Example schema
Expected output
Actual output
Related
The text was updated successfully, but these errors were encountered: