schema:
  type: object

  properties:
    wildchild:
      type: object

      $chld:
        type: string
        constraint: next.val().contains('Y') #todo internal quotes can't be ""

      properties:
        extra: {type: string}

      examples:
        - {chld1: "string not containing capitol y"} #passes becuase constraints are not evaluated with examples
        - {chld1: "anything", X: "as long as string its ok"}
        - {}
      nonexamples:
        - {chldX: true} #types are checked by the examples though, as that is part of core JSON schema
        - "root strings not allowed"

    wilderchild:
      type: object

      ~$chld:
        type: string
        constraint: next.val().contains('Y') #todo internal quotes can't be ""

      properties:
        extra: {type: string}

      examples:
        - {chld1: "string not containing capitol y"} #passes becuase constraints are not evaluated with examples
        - {chld1: "anything", X: "as long as string its ok"}
        - {}

      nonexamples:
        - {chldX: true} #types are checked by the examples though, as that is part of core JSON schema
        - "root strings not allowed"

    nested:
      type: object
      $chld:
        type: object
        $gchld:
          type: object
          constraint: next.val() != null
          properties:
            data: {type: string}

access:
  - location: wildchild
    read:  true
    write: true

  - location: wilderchild
    read:  true
    write: true


  - location: nested
    read:  auth != null
    write: auth != null
  - location: nested/$chld/$gchld
    read:  true
    write: true

