jcrygier / graphql-jpa

JPA Implementation of GraphQL (builds on graphql-java)
MIT License
165 stars 46 forks source link

Add new annotation used to ignore Types and Fields #23

Closed Baresse closed 7 years ago

Baresse commented 7 years ago

@GraphQLIgnore annotation may be used to specifiy that an attribute should not be part of the GraphQLSchema. It may also be used to specify that a given class should not be part of the GraphQLSchema. As a consequence ignored entities and fields will not be returned in the graphQL results.

Sample of usage at Entity level :

@GraphQLIgnore
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Configuration {

    @Id
    private String id;

    @NotEmpty
    private String libelle;
}

and Same of usage at Field level :

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {

    @Id
    private String id;

    @GraphQLIgnore
    @NotEmpty
    private String password;
}