-
Notifications
You must be signed in to change notification settings - Fork 177
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
Validation error of type SubSelectionRequired: Sub selection required for type Timestamp of field #251
Comments
The timestamp object is treated as an object/entity and it does not have any (exposed) members; that's why. You either need to expose members within the Timestamp object, or create and register a custom TypeMapper that convert between your Timestamp types and a scalar like an integer (so in your schema the ViewUserAccountPoint entity has an userAccountCreatedDate which is an integer). |
@codelizrd is right. If But, is |
Now that I look, if your I also now see that |
Answered your StackOverflow question as well. Quoting:
public class TimestampMapper implements TypeMapper {
// Define the scalar as needed, see io.leangen.graphql.util.Scalars for inspiration
private static final GraphQLScalarType TIMESTAMP = ...;
@Override
public GraphQLOutputType toGraphQLType(AnnotatedType javaType, OperationMapper operationMapper, Set<Class<? extends TypeMapper>> mappersToSkip, BuildContext buildContext) {
return TIMESTAMP; //it's important to always return the same instance
}
@Override
public GraphQLInputType toGraphQLInputType(AnnotatedType javaType, OperationMapper operationMapper, Set<Class<? extends TypeMapper>> mappersToSkip, BuildContext buildContext) {
return TIMESTAMP; //same as above
}
@Override
public boolean supports(AnnotatedType type) {
return ClassUtils.isSuperClass(Timestamp.class, type);
}
}
generator.withTypeMappers(new TimestampMapper()) |
I'll close this one since there's no feedback and it seems sufficiently addressed. |
I use GraphQL-SPQR Library The problem is "Validation error of type SubSelectionRequired: Sub selection required for type Timestamp" Maybe there is expression in query for timestamp or format in Entity
`{"query":
"{findUserPointByUserId(userId:73){rowNum userAccountPointUserId totalPoint pointTypeDescription point userAccountCreatedDate} findUserAccountImgByUserId(userId:73){imageId,userId,presentImgNum}}"
}`
Error
{ "errors": [ { "message": "Validation error of type SubSelectionRequired: Sub selection required for type Timestamp of field userAccountCreatedDate", "locations": [ { "line": 1, "column": 103 } ] } ] }
Entity
`public class ViewUserAccountPoint {
@id
@basic
@GraphQLQuery(name = "rowNum")
@column(name = "row_num", nullable = true)
private Long rowNum;
I use @GraphQLQuery is there annotation for timestamp format??
Service
public List<ViewUserAccountPoint> findUserPointByUserId(@GraphQLArgument(name = "userId") Integer userId){ return viewUserAccountPointRepository.findByUserAccountPointUserIdOrderByUserAccountCreatedDateDesc(userId); }
I search through all query timestamp format However, i couldn't find
hope to hear the solution. thank you
The text was updated successfully, but these errors were encountered: