We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// test_str.ts export type A = `wifi${number}`;
// actual_str.json { "$ref": "#/definitions/A", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "A": { "type": "string" } } }
// expected_str.json { "$ref": "#/definitions/A", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "A": { "type": "string", "pattern": "^wifi[0-9]+$" } } }
// test_annotated_str.ts /** * @pattern ^wifi[0-9]+$ */ export type A = `wifi${number}`;
// actual_annotated_str.json // expected_annotated_str.json { "$ref": "#/definitions/A", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "A": { "pattern": "^wifi[0-9]+$", "type": "string" } } }
// test_annotated_key.ts /** * @pattern ^wifi[0-9]+$ */ type WifiDevName = string; export type A = Record<WifiDevName, number>;
// actual_annotated_key.json { "$ref": "#/definitions/A", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "A": { "additionalProperties": { "type": "number" }, "propertyNames": { "pattern": "^wifi[0-9]+$" }, "type": "object" } } }
// expected_annotated_key.json { "$ref": "#/definitions/A", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "A": { "patternProperties": { "^wifi[0-9]+$": { "type": "number" } }, "type": "object" } } }
// test_real_life.ts /** * @pattern ^lan[0-9]+$ */ type LedLanKey = `lan${number}`; /** * @pattern ^radio[0-9]+$ */ type LedRadioKey = `radio${number}`; type LedsLan = Record<LedLanKey, object>; type LedsRadio = Record<LedRadioKey, object>; export type A = LedsLan & LedsRadio & { power?: object; };
// actual_real_life.json { "$ref": "#/definitions/A", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "A": { "additionalProperties": { "type": "object" }, "properties": { "power": { "type": "object" } }, "type": "object" } } }
// expected_real_life.json { "$ref": "#/definitions/A", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "A": { "properties": { "power": { "type": "object" } }, "patternProperties": { "^lan[0-9]+$": { "type": "object" }, "^radio[0-9]+$": { "type": "object" } }, "type": "object" } } }
The text was updated successfully, but these errors were encountered:
I tried to read the code to contribute fix but didn't understand where to start.
Sorry, something went wrong.
No branches or pull requests
Typescript-restricted key (fail)
Annotated string (pass)
Annotated key (kinda pass)
Real life object (fail)
The text was updated successfully, but these errors were encountered: