# Data Schema

### Using JSON Schemas for Data Validation

JSON Schema is a powerful tool for data validation and description. It describes the structure and rules that a JSON data object must adhere to. Using JSON schemas in a microservices architecture helps in validating the data being exchanged between services.

Contextual also supports a small set of platform-specific schema extensions, such as `primaryKey`, `relations`, `secret`, `generate`, and UI-oriented `renderer` values. See [Contextual Schema Extensions](/documentation-and-resources/components-and-data/object-types/object-type-details/data-schema/contextual-schema-extensions.md).

#### Key Features of JSON Schema:

* **Type validation:** Ensures values in a data object are of expected types (e.g., strings, numbers, booleans).
* **Presence validation:** Checks for mandatory fields within a data object.
* **Format validation:** Validates formats of the data (e.g., date-time formats, email addresses).
* **Constraint validation:** Enforces restrictions like minimum/maximum values or string patterns.

{% code title="Example Data Schema" lineNumbers="true" %}

```json
{
  "type": "object",
  "properties": {
    "userId": {
      "type": "integer",
      "description": "The unique identifier for a user."
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "The user's email address."
    },
    "signupDate": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time when the user registered."
    }
  },
  "required": ["userId", "email", "signupDate"]
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.contextual.io/documentation-and-resources/components-and-data/object-types/object-type-details/data-schema.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
