Package io.jmix.graphql.datafetcher
Class GqlEntityValidationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.jmix.graphql.datafetcher.GqlEntityValidationException
- All Implemented Interfaces:
graphql.GraphQLError
,Serializable
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionGqlEntityValidationException
(EntityValidationException ex, Object parentEntity, MetaClass parentClass) GqlEntityValidationException
(String clientMessage) GqlEntityValidationException
(Throwable ex, String clientMessage) -
Method Summary
Modifier and TypeMethodDescriptionbuildFullPath
(Object entity, MetaClass metaClass, javax.validation.ConstraintViolation<?> cv, String path, Set<Object> visited) By default constraint violation (CV) contains only direct property path.composeErrorExtension
(javax.validation.ConstraintViolation<?> cv) graphql.ErrorClassification
List<graphql.language.SourceLocation>
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface graphql.GraphQLError
getMessage, getPath, toSpecification
-
Field Details
-
EXTENSION_CONSTRAINT_VIOLATIONS
- See Also:
-
EXTENSION_PERSISTENCE_ERROR_NAME
- See Also:
-
-
Constructor Details
-
GqlEntityValidationException
public GqlEntityValidationException(EntityValidationException ex, Object parentEntity, MetaClass parentClass) -
GqlEntityValidationException
-
GqlEntityValidationException
-
-
Method Details
-
getLocations
- Specified by:
getLocations
in interfacegraphql.GraphQLError
-
getErrorType
public graphql.ErrorClassification getErrorType()- Specified by:
getErrorType
in interfacegraphql.GraphQLError
-
getExtensions
- Specified by:
getExtensions
in interfacegraphql.GraphQLError
-
composeErrorExtension
-
buildFullPath
protected Stream<String> buildFullPath(Object entity, MetaClass metaClass, javax.validation.ConstraintViolation<?> cv, String path, Set<Object> visited) By default constraint violation (CV) contains only direct property path. For example when validation error relates to "name" in "car.garage.name" query - CV will contains "name" property only. For better user experience we need to define and return full path of validated property. In example above it's mean that method will return "car.garage.name" instead of "name".- Parameters:
entity
- - validated entitymetaClass
- - validated entity meta classcv
- - current constraint violationpath
- already composed part of pathvisited
- entities in object graph that already visited due to recursion- Returns:
- full property path
-