## Get Evaluation Data Schema

`client.Evaluations.GetSchema(ctx, evaluationID, query) (*EvaluationSchemaResponse, error)`

**get** `/v5/evaluations/{evaluation_id}/schema`

Describe the data schema of an evaluation's items.

Inspects the item `data` and task-result fields and returns each discovered field with its
flattened key path, JSON type, source, and the number of items containing it, ordered
alphabetically by field name. For large evaluations the schema may be inferred from a sample of
items, in which case `is_sampled` is set and `sample_size` reports how many were analyzed. Set
`include_archived` to include archived items in the analysis.

### Parameters

- `evaluationID string`

- `query EvaluationGetSchemaParams`

  - `IncludeArchived param.Field[bool]`

    Include archived items in schema analysis

### Returns

- `type EvaluationSchemaResponse struct{…}`

  Schema information for an evaluation's item data structure

  - `EvaluationID string`

    The ID of the evaluation

  - `Fields []EvaluationSchemaResponseField`

    List of all discovered fields, ordered alphabetically by field_name

    - `DataType string`

      JSON type: 'string', 'number', 'boolean', 'object', 'array', or 'null'

    - `FieldName string`

      The flattened JSON key path (e.g., 'metadata.category')

    - `ItemCount int64`

      Number of evaluation items containing this field

    - `Source string`

      The source of the field: 'data' or 'task_result_cache'

      - `const EvaluationSchemaResponseFieldSourceData EvaluationSchemaResponseFieldSource = "data"`

      - `const EvaluationSchemaResponseFieldSourceTaskResultCache EvaluationSchemaResponseFieldSource = "task_result_cache"`

    - `Object string`

      - `const EvaluationSchemaResponseFieldObjectFieldSchema EvaluationSchemaResponseFieldObject = "field_schema"`

  - `TotalItems int64`

    Total number of evaluation items

  - `IsSampled bool`

    Whether schema was computed from a sample of items (for large evaluations)

  - `Object EvaluationSchemaResponseObject`

    - `const EvaluationSchemaResponseObjectEvaluationSchema EvaluationSchemaResponseObject = "evaluation_schema"`

  - `SampleSize int64`

    Number of items sampled for schema inference, if applicable

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  evaluationSchemaResponse, err := client.Evaluations.GetSchema(
    context.TODO(),
    "evaluation_id",
    sgpdev.EvaluationGetSchemaParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", evaluationSchemaResponse.EvaluationID)
}
```

#### Response

```json
{
  "evaluation_id": "evaluation_id",
  "fields": [
    {
      "data_type": "data_type",
      "field_name": "field_name",
      "item_count": 0,
      "source": "data",
      "object": "field_schema"
    }
  ],
  "total_items": 0,
  "is_sampled": true,
  "object": "evaluation_schema",
  "sample_size": 0
}
```
