Class GraphQLBody


public class GraphQLBody extends Body<String>
  • Constructor Details

    • GraphQLBody

      public GraphQLBody(String query)
    • GraphQLBody

      public GraphQLBody(String query, String operationName, String variablesSchema)
  • Method Details

    • graphQL

      public static GraphQLBody graphQL(String query)
    • graphQL

      public static GraphQLBody graphQL(String query, String operationName)
    • graphQL

      public static GraphQLBody graphQL(String query, String operationName, String variablesSchema)
    • getQuery

      public String getQuery()
    • getOperationName

      public String getOperationName()
    • getVariablesSchema

      public String getVariablesSchema()
    • getSelectionSetMatchType

      public SelectionSetMatchType getSelectionSetMatchType()
    • withSelectionSetMatchType

      public GraphQLBody withSelectionSetMatchType(SelectionSetMatchType selectionSetMatchType)
    • getSchema

      public String getSchema()
      The GraphQL schema (SDL text or an introspection JSON result) associated with this expectation. When present, MockServer can synthesize a schema-valid response for a matched query without any hand-authored response JSON.
      Returns:
      the SDL/introspection schema, or null if none is registered
    • withSchema

      public GraphQLBody withSchema(String schema)
      Register a GraphQL schema (SDL text or an introspection JSON result) on this body so that schema-valid responses can be synthesized for matched queries.
      Parameters:
      schema - SDL text (e.g. "type Query { hello: String }") or an introspection JSON result (the data.__schema or full envelope)
      Returns:
      this body for fluent chaining
    • getFields

      public List<String> getFields()
    • withFields

      public GraphQLBody withFields(String... fields)
    • withFields

      public GraphQLBody withFields(List<String> fields)
    • getValue

      public String getValue()
      Specified by:
      getValue in class Body<String>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Body<String>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Body<String>
    • toString

      public String toString()
      Overrides:
      toString in class ObjectWithJsonToString