json-schema-to-ts icon indicating copy to clipboard operation
json-schema-to-ts copied to clipboard

VSCode syntax checking slow

Open yoshi-68 opened this issue 2 years ago • 3 comments

Importing FromSchema slows VSCode's syntax check.

yoshi-68 avatar Aug 03 '23 10:08 yoshi-68

@yoshi-68 Can you provide more details on your issue ? How did you use FromSchema ? What version ? etc.

ThomasAribart avatar Dec 18 '23 23:12 ThomasAribart

experiencing same issue with generics:

Here is an example:

export class ApiSchema<IN extends JSONSchema, OUT extends JSONSchema> {
    readonly path: string;
    readonly requestSchema: IN;
    readonly responseSchema: OUT;
    readonly requestValidate;

    constructor(path: string, requestSchema: IN, responseSchema: OUT) {
        this.path = path;
        this.requestSchema = requestSchema;
        this.responseSchema = responseSchema;
        this.requestValidate = ajv.compile(requestSchema);
    }

    buildPostApi(
        handle: (requestBody: FromSchema<IN>, request: RequestEvent) => Promise<FromSchema<OUT>>
    ): (event: RequestEventAny) => Response | Promise<Response> {
       ...
    }
}

Seancheey avatar Feb 15 '24 21:02 Seancheey

@Seancheey this might be a bit old and maybe you've moved from it, but the docs in here helped me solve this: https://github.com/ThomasAribart/json-schema-to-ts/blob/main/documentation/FAQs/applying-from-schema-on-generics.md

They should be displayed more promptly!

fermuch avatar Mar 28 '24 13:03 fermuch