Package org.springframework.graphql
Interface ResponseField
- All Known Subinterfaces:
ClientResponseField
public interface ResponseField
Representation for a field in a GraphQL response, with options to examine
the field value and errors.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionReturn all errors that have a path, and it is at above, or below the field path.Return a parsed representation of the field path, in the format described for error paths in Section 7.1.2, "Response Format" of the GraphQL spec.getPath()Return a String representation of the field path as described inClientGraphQlResponse.field(String).<T> TgetValue()Return the raw field value, e.g.
-
Method Details
-
getPath
String getPath()Return a String representation of the field path as described inClientGraphQlResponse.field(String). -
getParsedPath
Return a parsed representation of the field path, in the format described for error paths in Section 7.1.2, "Response Format" of the GraphQL spec.- See Also:
-
getValue
Return the raw field value, e.g. Map, List, or a scalar type.- Type Parameters:
T- the expected value type to cast to- Returns:
- the value
-
getErrors
List<ResponseError> getErrors()Return all errors that have a path, and it is at above, or below the field path.According to the GraphQL spec, section 6.4.4, "Handling Field Errors" if a field has an error it is set to
null. That means a field has either a value or an error, and there is only one error per field.Errors may also occur at paths above or below the field path. Consider the following cases:
Value Errors Case Non- nullEmpty Success Non- nullErrors below Partial with errors on nested fields nullError at field Field failure nullError above field Parent field failure nullError below field Nested field failure bubbles up because field is required
-