Skip to content
New issue

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

Issue: All fields with @default(xxx) should be optional in GraphQL Schema #96

Closed
Tenrys opened this issue Jan 12, 2023 · 1 comment
Closed
Assignees
Labels
is: bug Something isn't working package: generator Generator package
Milestone

Comments

@Tenrys
Copy link
Contributor

Tenrys commented Jan 12, 2023

I would expect to be able to omit required fields that have a default value entirely, so that the database can fill them up for me if I choose not to specify them, but it looks like a field is only considered "auto-populated" under very specific conditions:

private isFieldAutoPopulated(searchField: DMMF.Field): boolean {
const defaultValue: any = searchField?.default || null
return (
defaultValue?.name === 'autoincrement'
|| defaultValue?.name === 'uuid'
|| defaultValue?.name === 'cuid'
|| searchField.isUpdatedAt
|| ['updatedAt', 'createdAt'].includes(searchField.name)
)
}

Shouldn't it just be flagged as such as long as it has a valid @default attributes?

@maoosi maoosi changed the title Bug: Required field of type Boolean with @default(true) or @default(false) is not optional in the GraphQL query Issue: All fields with @default(xxx) should be optional in GraphQL Schema Jan 13, 2023
@maoosi maoosi added is: bug Something isn't working package: generator Generator package labels Jan 13, 2023
@maoosi maoosi moved this to Ready to release in Prisma-AppSync Roadmap Jan 13, 2023
@maoosi maoosi added this to the 1.0.0-rc.6 milestone Jan 13, 2023
@maoosi maoosi self-assigned this Jan 13, 2023
@maoosi
Copy link
Owner

maoosi commented Jan 13, 2023

Will be release as part of 1.0.0-rc.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug Something isn't working package: generator Generator package
Projects
Status: Released
Development

No branches or pull requests

2 participants