We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
I am trying to convert a type that looks like:
import type {Person} from '@myorg/common-types" export type MemberInfo = Required<Person>;
where person is defined in a common library:
export type Person = { /** * * @type {string} * @memberof {Person} */ name: string; }
The output type looks something like: ```json { "type": "object", "properties": { "name": "{string}" } }
I used the following in an npm script:
{ "scripts": { "generate:schema":"quicktype --src ./types/post/memberInfoTypes.ts --src-lang typescript --lang schema --out ./schemas/post/memberInfoSchema.json" } }
Quicktype Output (JSON Schema from Typescript)
Nodejs Version: v20.19.0 Package Manager: pnpm 10.6.2 OS: MacOS 15.4
Input Format: Typescript Output Language: JSON Schema
CLI Version: 23.0.171
I would like to take existing typescript types and convert them to json schema for validation using something like ajv.
export type MemberInfo = Required<Person>;
export type Person = { /** * * @type {string} * @memberOf {Person} */ name: string; }
The type string is valid JSON Schema while the type "{string}" is not.
string
"{string}"
{ "type": "object", "properties": { "name": "string" } }
{ "type": "object", "properties": { "name": "{string}" } }
My wild guess is that it may be reading the JSDoc annotations and using them to infer types instead of relying on the typescript definition.
Clone the repo: https://github.com/vamsiampolu/quicktype-ts-to-json-schema-issue
nvm use
pnpm install
pnpm generate:schema
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
I am trying to convert a type that looks like:
where person is defined in a common library:
export type Person = {
/**
*
* @type {string}
* @memberof {Person}
*/
name: string;
}
I used the following in an npm script:
Issue Type
Quicktype Output (JSON Schema from Typescript)
Context (Environment, Version, Language)
Nodejs Version: v20.19.0
Package Manager: pnpm 10.6.2
OS: MacOS 15.4
Input Format: Typescript
Output Language: JSON Schema
CLI
Version: 23.0.171
Description
I would like to take existing typescript types and convert them to json schema for validation using something like ajv.
Input Data
where person is defined in a common library:
Expected Behaviour / Output
The type
string
is valid JSON Schema while the type"{string}"
is not.Current Behaviour / Output
My wild guess is that it may be reading the JSDoc annotations and using them to infer types instead of relying on the typescript definition.
Steps to Reproduce
Clone the repo: https://github.com/vamsiampolu/quicktype-ts-to-json-schema-issue
nvm use
to set the Node versionpnpm install
to install the dependencies.pnpm generate:schema
from the repositoryPossible Solution
The text was updated successfully, but these errors were encountered: