---
# System prepended metadata

title: Schemas

---

# Schemas

```
type: object
properties:
  data_params:
    type: array
    items:
      oneOf:
        - $ref: "#/definitions/vires_data_params"
        - $ref: "#/definitions/hapi_data_params"
    description: "List of data parameter objects, each conforming to either vires_data_params or hapi_data_params."
required:
  - data_params
additionalProperties: false

definitions:
  vires_data_params:
    type: object
    properties:
      provider:
        type: string
        description: "Data provider name."
        enum:
          - "vires"
      collection:
        type: string
        description: "Name of the data collection."
      measurements:
        type: array
        items:
          type: string
        description: "List of measurement fields to retrieve."
      models:
        type: array
        items:
          type: string
        description: "List of models to use."
      start_time:
        type: string
        format: date-time
        description: "Start time for the data retrieval in ISO 8601 format."
      end_time:
        type: string
        format: date-time
        description: "End time for the data retrieval in ISO 8601 format."
      server_url:
        type: string
        format: uri
        description: "URL of the server to connect to."
      options:
        type: object
        properties:
          asynchronous:
            type: boolean
            description: "Submit request as an asynchronous job."
          show_progress:
            type: boolean
            description: "Whether to show progress during the operation."
        additionalProperties: true
        description: "Additional options for the data retrieval."
    required:
      - provider
      - collection
      - start_time
      - end_time
      - server_url
    additionalProperties: false
    description: "Schema for VirES data parameters configuration."

  hapi_data_params:
    type: object
    properties:
      provider:
        type: string
        description: "Data provider name."
        enum:
          - "hapi"
      dataset:
        type: string
        description: "Identifier of the HAPI dataset."
      parameters:
        type: array
        items:
          type: string
        description: "List of parameters to retrieve from the HAPI dataset."
      start_time:
        type: string
        format: date-time
        description: "Start time for the data retrieval in ISO 8601 format."
      end_time:
        type: string
        format: date-time
        description: "End time for the data retrieval in ISO 8601 format."
      server_url:
        type: string
        format: uri
        description: "URL of the HAPI server to connect to."
      options:
        type: object
        additionalProperties: true
        description: "Additional options for the HAPI data retrieval."
    required:
      - provider
      - dataset
      - start_time
      - end_time
      - server_url
    additionalProperties: false
    description: "Schema for HAPI data parameters configuration."
```

```python
import yaml
from jsonschema import validate

with open("pal-schema.yaml", "r") as file:
    schema = yaml.safe_load(file)

data = {
    "data_params": [
        {
            "provider": "vires",
            "collection": "example_collection",
            "measurements": ["measurement1", "measurement2"],
            "models": ["model1", "model2"],
            "start_time": "2025-04-10T00:00:00Z",
            "end_time": "2025-04-11T00:00:00Z",
            "server_url": "https://example.com",
            "options": {
                "asynchronous": True,
                "show_progress": False,
            }
        }
    ]
}

validate(instance=data, schema=schema)
```