Closed bring-shrubbery closed 2 months ago
@omar-dulaimi Tagging you to review this, since you were the one to implement the @@Gen.model(hide: true)
feature, hope you don't mind me tagging you :)
Hey @bring-shrubbery Thanks for the PR! I'll take a look
It seems to be working fine. But I noticed this validation error:
Property 'hiddenField' is missing in type '{ value: string; key: string; }' but required in type 'MapCreateInput'.ts(2322)
It happens in MapCreateInput.schema.ts
:
import { z } from 'zod';
import type { Prisma } from '@prisma/client';
const Schema: z.ZodType<Prisma.MapCreateInput> = z
.object({
key: z.string(),
value: z.string(),
})
.strict();
export const MapCreateInputObjectSchema = Schema;
To solve it I think we should get rid of the type casting this library currently do z.ZodType<Prisma.MapCreateInput>
.
But that would cause issues reported in the past about schemas that reference themselves. I read somewhere that wrapping all generated schemas with z.lazy
should solve the issue, but haven't tried that yet.
Also, there seems to be a current problem while ignoring fields, when ignoring the same field hidden, the while create map schemas disappears despite having two remaining fields.
These are all my thoughts so far.
@omar-dulaimi Nice catch! I'll take a look at it this week and will try to implement a fix using your suggestions.
Hey @bring-shrubbery Any update on this?
Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
This PR adds a way of hiding properties of models using a doc string. The API is the same as hiding models, but uses
.property
instead of.model
in the doc string.Also, here's a list of the things done in this PR:
References
Implements solution for #75