---
id: "site.json"
"$schema": "http://json-schema.org/draft-04/schema"
title: Site
description: Grid site
type: object
properties:
  id:
    "$ref": "base.json#/definitions/uuid"
  name:
    type: string
    description: User-readable name of the website
  repo:
    type: string
    description: GitHub repository path for website sources
    "$ref": "base.json#/definitions/site"
  domain:
    type: [string, "null"]
    format: hostname
    example: 'blog.thegrid.io'
    description: Custom domain for the website, if any
  path:
    type: [string, "null"]
    example: '/news'
    description: Subdirectory path for the website, if any
  config:
    "$ref": "siteconfig.json"
  owner:
    "$ref": "base.json#/definitions/uuid"
  url:
    description: Full site URL based on domain and path
    "$ref": "base.json#/definitions/url"
  favlogo:
    description: URL of the website favlogo
    "$ref": "base.json#/definitions/url"
  created_at:
    type: string
    format: 'date-time'
  updated_at:
    oneOf:
    - { type: 'null' }
    - { type: 'string', format: 'date-time' }

required: [name, repo]
oneOf:
  - { required: [domain] }
  - { required: [path] }

---
id: "site.json"
"$schema": "http://json-schema.org/draft-04/schema"
title: Site
description: Grid site
type: object
properties:
  id:
    "$ref": "base.json#/definitions/uuid"
  name:
    type: string
    description: User-readable name of the website
  repo:
    type: string
    description: GitHub repository path for website sources
    "$ref": "base.json#/definitions/site"
  domain:
    type: [string, "null"]
    format: hostname
    example: 'blog.thegrid.io'
    description: Custom domain for the website, if any
  path:
    type: [string, "null"]
    example: '/news'
    description: Subdirectory path for the website, if any
  config:
    "$ref": "siteconfig.json"
  owner:
    "$ref": "base.json#/definitions/uuid"
  url:
    description: Full site URL based on domain and path
    "$ref": "base.json#/definitions/url"
  favlogo:
    description: URL of the website favlogo
    "$ref": "base.json#/definitions/url"
  created_at:
    type: string
    format: 'date-time'
  updated_at:
    oneOf:
    - { type: 'null' }
    - { type: 'string', format: 'date-time' }

required: [name, repo]
anyOf:
  - { required: [domain] }
  - { required: [path] }

Allow also input of domain and path
Allow also input of domain and path
