I have a Date defined as a Scalar in my schema.
Is there a way to define the rules regarding the legal values in only one place?
I could probably define a directive on FIELD_DEFINITION and apply it on each field of this type. However, I would like to do it once. Is that possible?
Here is my code. The CitizenshipCode is actually a string, limited to the values "us", "uk", "de", etc. I would like to implement the validation in a centralised way, rather than adding a directive to each field of this type:
scalar CitizenshipCode # is it possible to implement the validation here?
type Client {
id: ID!
name: String
citizenship: CitizenshipCode # instead of here...
# other atts
}
type User {
id: ID!
email: String
citizenship: CitizenshipCode # ... and here
# other atts
}