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

Validator accepts arbitrary properties in datasource blocks #7342

Closed
janpio opened this issue May 29, 2021 · 4 comments · Fixed by prisma/prisma-engines#2683
Closed

Validator accepts arbitrary properties in datasource blocks #7342

janpio opened this issue May 29, 2021 · 4 comments · Fixed by prisma/prisma-engines#2683
Assignees
Labels
kind/improvement An improvement to existing feature and code. team/psl-wg team/schema Issue for team Schema. topic: prisma validate CLI: prisma validate topic: validation
Milestone

Comments

@janpio
Copy link
Member

janpio commented May 29, 2021

Bug description

This schema is happily accepted:

generator client {
  provider        = "prisma-client-js"
  foo             = bar
}

datasource db {
  provider          = "mysql"
  url               = env("DATABASE_URL")
  shadowUrlDatabase = env("SHADOW_DATABASE_URL")
  foo               = bar
}

That is unfortunate, as shadowUrlDatabase should really be shadowDatabaseUrl instead, and foo of course does nothing as it is not a known property.

Prisma Version

2.23.0

@janpio janpio added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. topic: prisma validate CLI: prisma validate topic: validation labels May 29, 2021
@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels May 31, 2021
@janpio janpio added the team/schema Issue for team Schema. label May 31, 2021
@Jolg42 Jolg42 added kind/improvement An improvement to existing feature and code. team/psl-wg and removed process/candidate kind/bug A reported bug. bug/2-confirmed Bug has been reproduced and confirmed. labels Dec 1, 2021
@do4gr
Copy link
Member

do4gr commented Jan 12, 2022

For datasources we only allow a specific set of properties. And for the only the prisma-client-js generator as well. Other generators can have arbitrary properties.

@pimeys pimeys self-assigned this Feb 11, 2022
@pimeys
Copy link
Contributor

pimeys commented Feb 11, 2022

We do have an arbitrary key/value storage in the generator. I don't want to touch those validations, but datasource we know and can validate what should not be there.

@janpio
Copy link
Member Author

janpio commented Feb 11, 2022

We do have an arbitrary key/value storage in the generator

If provider = "prisma-client-js" then we also have a defined list of properties that are possible. If we can scope this validation to this generator.provider value, we can give our users value.

@Jolg42 Jolg42 added this to the 3.10.0 milestone Feb 11, 2022
@janpio
Copy link
Member Author

janpio commented Feb 15, 2022

Follow up in #11825

@janpio janpio changed the title Validator accepts arbitrary properties in generator and datasource blocks Validator accepts arbitrary properties in datasource blocks Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement An improvement to existing feature and code. team/psl-wg team/schema Issue for team Schema. topic: prisma validate CLI: prisma validate topic: validation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants