# Introduction

## Resource type schema

### Example

```json
{
"$id": "/v1/users/me/operations/resource_types/schema",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Description of available ResourceTypes (with their properties)",
"type": "object",
"properties": {
    "ResourceType 2": {
        "description": "image/jpeg",
        "type": "object",
        "kind": "regular",
        "properties": {
            "ResourceTypeAttribute 3": {
                "type": "string",
                "enum": ["radio input value 1", "radio input value 2"]
            },
            "ResourceTypeAttribute 4": {
                "type": "array",
                "items": {
                    "type": "string",
                    "enum": ["select input value 1", "select input value 2"]
                }
            }
        },
        "required": [
    "ResourceTypeAttribute 3"
  ]
    },
    "ResourceType 1": {
        "description": "image/jpeg",
        "type": "object",
        "kind": "regular",
        "properties": {
            "ResourceTypeAttribute 1": {
                "type": "string"
            },
            "ResourceTypeAttribute 2": {
                "type": "array",
                "items": {
                    "type": "string"
                }
            },
            "Campaign start date": {
                "type": "datetime"
            },
            "Campaign end date": {
                "type": "datetime",
                "validates_gt_against": "Campaign start date"
            }
        },
        "required": [
    "ResourceTypeAttribute 2"
  ]
    },
    "Coupon": {
        "description": "image/png;image/jpeg;image/gif",
        "type": "object",
        "kind": "offer",
        "properties": {
            "Collection": {
                "type": "offer_collection_id"
            },
            "Start date": {
                "type": "datetime"
            },
            "Expiration date": {
                "type": "datetime",
                "validates_gt_against": "Start date"
            },
            "Offer": {
                "type": "string"
            },
            "Description of offer": {
                "type": "text"
            },
            "Channel": {
                "type": "array",
                "items": {
                    "type": "string",
                    "enum": [
                        "Instagram",
                        "Facebook",
                        "Website",
                        "E-mail message",
                        "App Coupon",
                        "SMS message"
                    ]
                }
            }
        },
        "required": [
            "Collection"
        ]
    }
  }
}
```

### Definition

Key | Type                       | Optional | Description
--------- |----------------------------| --------- | ---------
$id | string                     | yes | path of this schema (auto-generated)
$schema | string                     | yes | draft which this schema is compatible with (auto-generated)
description | string                     | yes | description of this schema (auto-generated)
type | string                     | yes | type of this schema (auto-generated)
kind | enum: ['regular', 'offer'] | yes | resource type kind
properties | object                     | no | description of how the resource type properties look like for each of the resource types and their attributes (and whether they are required)
properties.{{resource_type}}.properties.{{property_name}}.type | string | no | type of property - see [here](doc-341724#resource-type-schema-properties-types)

### Resource type schema properties types

Properties may have following type:

Type | Basic type
----- | ---------
string | string
boolean | boolean
datetime | datetime
text | string
custom_named_string | string
offer_collection_id | integer