Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Static fields in model class #73

Open
futzl opened this issue Mar 27, 2019 · 1 comment
Open

Static fields in model class #73

futzl opened this issue Mar 27, 2019 · 1 comment

Comments

@futzl
Copy link

futzl commented Mar 27, 2019

I reuse custom types in my model class, for example a class called CreditCardNumber. Static fields in this class are also send with the request. On server side, the validation failed because of that static field is not defined in the schema.

public class CreditCardNumber {
    private static final Pattern REGEX = Pattern.compile("\\d{12;19}");
    private String number;
    ...
}

Because I share my custom types across different projects, I'm not able to annote the static field with @GraphQLIgnore.

How should I handle this? Is it a bug, that static fields are in included? May Mixins as used by Jackson be a possible solution?

@guptaavi
Copy link

I have the same issue. Most of the model classes are reused across projects and they are all Serializable, thus causing the serialVersionUID to be included in the generated query. This fails validation because the serialVersionUID is not part of the schema. I have no control over the generated models and cannot put a @GraphQLIgnore annotation on this field.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants