Any

Arbitrary JSON value scalar type

Audience: Programmer

The Any scalar type represents an arbitrary JSON value of any type - object, array, string, number, boolean, or null.

Format

  • Accepts any valid JSON value

  • Can be object, array, primitive, or null

  • No schema validation

  • Serialized as JSON

Usage

type WorkflowSignal {
  id: ID!
  name: String!
  payload: Any  # Can be any JSON value
}

mutation {
  createWorkflowSignal(input: {
    name: "process_order"
    payload: {
      "orderId": "12345",
      "items": [
        {"sku": "ABC", "qty": 2},
        {"sku": "XYZ", "qty": 1}
      ],
      "priority": 1,
      "rush": true
    }
  }) {
    signal {
      id
      payload
    }
  }
}

Valid Values

All of these are valid Any values:

Use Cases

  • Workflow payloads with dynamic structure

  • Configuration objects

  • Event data with varying schemas

  • Integration payloads

  • Backwards compatibility

Best Practices

  1. Use sparingly - prefer typed fields when possible

  2. Document expected structure

  3. Validate on the server side

  4. Consider using Map for object-only data

  5. Version your payload structures

Comparison with Map

  • Any: Accepts any JSON value (objects, arrays, primitives)

  • Map: Only accepts JSON objects

See Also

Last updated

Was this helpful?