Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl committed Jun 23, 2022
1 parent 8ed8714 commit d37c63a
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions docs/namespace_config_spec.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Namespace Configuration Language Specification

The Keto namespace configuration language is a syntactical subset of TypeScript.
Along with type definitions for the syntax elements of the language (such as
`Namespace` or `Context`), users can get context help from their IDE while
writing the configuration.
# The "Keto Schema Language" Specification

Enforcing fine-grained permissions is a critical building block of mature
technology solutions that protect privacy and identity in the information age. A
number of proprietary languages to represent permission already exists, namely
the [Authzed Schema Language](https://docs.authzed.com/reference/schema-lang)
and [Auth0 FGA](https://docs.fga.dev/). Many permissions are defined by normal
developers who typically are most familiar with web technologies like JavaScript
or Typescript. We therefore see the need for a developer-friendly configuration
language for permissions that has such a small learning curve that it can be
picked up, used, and understood with confidence by most developers. We therefore
chose to define our permissions configuration language as a subset of the most
common general-purpose programming language: JavaScript/TypeScript.

The Keto Schema Language is a syntactical subset of TypeScript. Along with type
definitions for the syntax elements of the language (such as `Namespace` or
`Context`), users can get context help from their IDE while writing the
configuration.

## Notation

Expand All @@ -19,7 +31,8 @@ Option = "[" Expression "]" .
Repetition = "{" Expression "}" .
```

Productions are expressions constructed from terms and the following operators, in increasing precedence:
Productions are expressions constructed from terms and the following operators,
in increasing precedence:

```ebnf
| alternation
Expand All @@ -28,9 +41,13 @@ Productions are expressions constructed from terms and the following operators,
{} repetition (0 to n times)
```

Lower-case production names are used to identify lexical tokens. Non-terminals are in CamelCase. Lexical tokens are enclosed in double quotes "".
Lower-case production names are used to identify lexical tokens. Non-terminals
are in CamelCase. Lexical tokens are enclosed in double quotes "".

The form `a … b` represents the set of characters from a through b as alternatives. The horizontal ellipsis `` is also used elsewhere in the spec to informally denote various enumerations or code snippets that are not further specified.
The form `a … b` represents the set of characters from a through b as
alternatives. The horizontal ellipsis `` is also used elsewhere in the spec to
informally denote various enumerations or code snippets that are not further
specified.

## Configuraton text representation

Expand All @@ -40,13 +57,18 @@ The configuration is encoded in UTF-8.

### Comments

1. Line comments start with the character sequence // and stop at the end of the line.
2. General comments start with the character sequence /* and stop with the first subsequent character sequence */.
3. Documentation comments start with the character sequence /** and stop with the first subsequent character sequence */.
1. Line comments start with the character sequence // and stop at the end of the
line.
2. General comments start with the character sequence /* and stop with the first
subsequent character sequence */.
3. Documentation comments start with the character sequence /** and stop with
the first subsequent character sequence */.

### Identifiers

Identifiers name program entities such as variables and types. An identifier is a sequence of one or more letters and digits. The first character in an identifier must be a letter.
Identifiers name program entities such as variables and types. An identifier is
a sequence of one or more letters and digits. The first character in an
identifier must be a letter.

```ebnf
identifier = letter { letter | digit } .
Expand Down

0 comments on commit d37c63a

Please sign in to comment.