prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

generate inputs args ... with comments

Open liuwei0514 opened this issue 3 years ago • 6 comments

generated models are with comments is there any way to generate inputs args ... with comments?

liuwei0514 avatar Nov 29 '21 07:11 liuwei0514

How are seeing this? Could you provide an example?

unlight avatar Nov 29 '21 22:11 unlight

user.model.ts have descriptions image but user-where.input.ts user-create.input.ts ... don't have descriptions image these descriptions are useful. we can use these descriptions generate column title in frontend project.

liuwei0514 avatar Nov 30 '21 08:11 liuwei0514

Ok, got it. But meaning of this field in *whereinput class is different. This is like search condition, not the value.

If you are introspecting schema, why you cant take this description from models?

unlight avatar Nov 30 '21 11:11 unlight

i want generate search form from user-where.input.ts . keep zhe same schema.

request variables require this structure image i will generate form that submit zhe same structure data. i am dealing this useing formily

By the way , thank you for this amazing tool !

liuwei0514 avatar Nov 30 '21 15:11 liuwei0514

I can suggest generate comments for inputs by following way: It will be configuration setting

inputFieldDescription = "Filter {model.name} for {fied.name}"

It may generate class like:

@InputType()
export class UserWhereInput {
    @Field(() => StringFilter, { nullable: true, description: "Filter User by name" })
    name?: StringFilter;
}

It will possible to add more tokens: model name in plural, etc.

unlight avatar Dec 02 '21 18:12 unlight

I can suggest generate comments for inputs by following way: It will be configuration setting

inputFieldDescription = "Filter {model.name} for {fied.name}"

It may generate class like:

@InputType()
export class UserWhereInput {
    @Field(() => StringFilter, { nullable: true, description: "Filter User by name" })
    name?: StringFilter;
}

It will possible to add more tokens: model name in plural, etc.

I think it will not work, we have different kinds of inputs: create, update, where, where unique, etc. single comment pattern is not suitable for them.

unlight avatar Dec 06 '21 19:12 unlight