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
Given the following JSON schema input:
const jsonSchemaDraft7 = { $schema: 'http://json-schema.org/draft-07/schema#', type: 'object', additionalProperties: false, properties: { email: { anyOf: [ { type: 'string' }, { type: 'array', items: { type: 'number' } } ] } } };
Generate the following TypeScript model:
class Root { private _email?: string | number | any[]; constructor(input: { email?: string | number | any[], }) { this._email = input.email; } get email(): string | number | any[] | undefined { return this._email; } set email(email: string | number | any[] | undefined) { this._email = email; } }
Looks like the schema for the array and the array items schema are somehow interpreted as two separate things.
Expected the class to be:
class Root { private _email?: string | number[]; constructor(input: { email?: string | number[], }) { this._email = input.email; } get email(): string | number[] | undefined { return this._email; } set email(email: string | number[] | undefined) { this._email = email; } }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the bug
Given the following JSON schema input:
Generate the following TypeScript model:
Looks like the schema for the array and the array items schema are somehow interpreted as two separate things.
Expected behavior
Expected the class to be:
The text was updated successfully, but these errors were encountered: