String

UTF-8 character sequence scalar type

Audience: Programmer

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Format

  • UTF-8 encoded text

  • No length limit (unless specified by field)

  • Supports all Unicode characters

  • Empty strings are valid

Usage

type Customer {
  id: ID!
  name: String!
  description: String  # Nullable
  code: String!
}

mutation {
  createCustomer(input: {
    name: "Acme Corporation"
    code: "ACME-001"
    description: "Primary supplier for widgets"
  }) {
    customer {
      id
    }
  }
}

Common String Fields

  • Names and titles

  • Descriptions and comments

  • Codes and SKUs

  • URLs and paths

  • JSON strings (for Map fields)

Filtering

String fields often support these filters:

  • field_CONTAINS - Substring match

  • field_STARTS_WITH - Prefix match

  • field_ENDS_WITH - Suffix match

  • field_IN - Match any of the values

  • field_NOT - Negation

See Also

Last updated

Was this helpful?