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

Custom attributes #1660

Closed
schickling opened this issue Feb 20, 2020 · 4 comments
Closed

Custom attributes #1660

schickling opened this issue Feb 20, 2020 · 4 comments
Labels
domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. domain/psl Issue in the "PSL" domain: Prisma Schema Language kind/feature A request for a new feature. topic: generator topic: schema

Comments

@schickling
Copy link
Member

There are a lot of use cases (e.g. #1604, https://github.com/MichalLytek/type-graphql/issues/476, graphql-nexus/nexus-plugin-prisma#584, ...) which would benefit from the Prisma schema allowing the definition of "custom attributes" which should be exposed through the Prisma SDK.

@SrZorro
Copy link

SrZorro commented Nov 24, 2020

At my company we are currently implementing a custom attribute system for the typegraphql-prisma generator as it looks like Prisma doesn't have yet a native way to extend it for generator consumers.

We would like to be alienated with the Prisma team in the long run so our extension system maybe could work as a base to what could be brought back to Prisma as a native way to do it.

We have currently an RFC with our proposal that we are already implementing it, but if posible we would like to get feedback from the Prisma team about it.

@janpio janpio removed the size/M label Feb 18, 2021
@pantharshit00 pantharshit00 added the domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. label Apr 23, 2021
@janpio janpio added the domain/psl Issue in the "PSL" domain: Prisma Schema Language label Feb 6, 2022
@jmarbutt
Copy link

jmarbutt commented Feb 18, 2022

In a lot of applications I have used custom attributes to do a few common things ranging from:

  • Defining things like Description Name and other basic attributes that may help describe how it is displayed in a UI or for Documentation from the API.
  • Going beyond simple properties we have defined things like SelectBox or DateBox to go in more detail of how to show these.

An example in .Net we have used is something like this

[TextBox("Middle Name")] 
public string MiddleName { get; set; }

[TextBox("Postal Code", GridVisible = true, GridOrder = 8, ShowInGroupBy = true)]
public string PostalCode { get; set; }

I have used similar patterns in other projects where we allowed this to build up a definition of what a model looks like to the application. This allows models to be consistent across multiple UIs and the model definition contains everything the UI would need to know about how to display the model.

@janpio
Copy link
Member

janpio commented Nov 2, 2022

Is there anything here in this issue not covered by #3102? Otherwise I think we should close this one and focus on #3102.

@jmarbutt
Copy link

jmarbutt commented Nov 2, 2022

I think #3102 has everything that I have asked for.

@janpio janpio closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. domain/psl Issue in the "PSL" domain: Prisma Schema Language kind/feature A request for a new feature. topic: generator topic: schema
Projects
None yet
Development

No branches or pull requests

6 participants