Skip to content

Commit ca7ec3b

Browse files
Fix string types
1 parent 29967ba commit ca7ec3b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/common/types.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ sidebar_position: 2
77
These are types used throughout the rest of this specification and defined here once to avoid repetition.
88

99
- `string`: a valid UTF-8 string. While being processed in code, it might be in a different encoding temporarily, but in the public interface of Opencast, these are always valid UTF-8.
10-
- `NonBlankString`: **N**on-**E**mpty string.
11-
- `Neas`: **N**on-**E**mpty **A**SCII **S**tring.
12-
- `Label`: non-empty, ASCII-only string that only consists of letters, numbers or `-._~!*:@,;`. This means a label is URL-safe except for use in the domain part.<sup>(2?)</sup>
10+
- `NonBlankString`: A string that is not "blank", meaning it is not empty and does not consists only of [Unicode `White_Space`](https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt).
11+
- `NonBlankAsciiString`: A `NonBlankString` that is also restricted to only using ASCII characters.
12+
- `Label`: a `NonBlankAsciiString` that only consists of letters, numbers or `-._~!*:@,;`. This means a label is URL-safe except for use in the domain part.<sup>(2?)</sup>
1313
- `ID`: a `Label` that cannot be changed after being created.
1414
- `Username`: TODO define rules for usernames
1515
- `LangCode`: specifies a language and optionally a region, e.g. `en` or `en-US`. Based on the [IETF BCP 47 language tag specification](https://www.rfc-editor.org/info/rfc5646): a two letter language code, optionally followed by a hyphen and a two letter region tag.
@@ -30,7 +30,7 @@ Generally, this basically uses TypeScript syntax:
3030

3131
For most types, the JSON serialization is the obvious one, but there are some minor important details.
3232
- `bool` as `bool`
33-
- `string` and all "string with extra requirements" (e.g. `Label`, `ID`, `Neas`) as string
33+
- `string` and all "string with extra requirements" (e.g. `Label`, `ID`, `NonBlankAsciiString`) as string
3434
- Integers as number.
3535
- Note on 64 bit integers: In JavaScript, there is only one `number` type, which is a 64 bit floating point number (`double`, `f64`).
3636
Those can only exactly represent integers up to 2<sup>53</sup>.

docs/event/assets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Each asset has some asset-metadata that is stored in the DB, while the file itse
99

1010
Every asset has this metadata attached to it:
1111
- `id: ID`: unique identifier among all assets of all events. Assigned by Opencast and unchangable.
12-
- `flavor: Neas` <sup>(1?)</sup>
12+
- `flavor: NonBlankAsciiString` <sup>(1?)</sup>
1313
- `tags: string[]` <sup>(1?)</sup>
1414
- `properties: Map<Label, string>`: a `Label` to string map for custom properties. Values can be arbitrary strings.<sup>(7?)</sup>
15-
- `mimeType: Neas`: a *lowercase* `Neas` representing the MIME-type of the asset.
15+
- `mimeType: NonBlankAsciiString`: a *lowercase* `NonBlankAsciiString` representing the MIME-type of the asset.
1616
- `size: uint64`: size of the file in bytes. This is always the actual file size and cannot be changed manually.
1717
- `checksum`: Checksum/hash of the file. Consists of `type` (e.g. `md5`, `sha256`) and the hex encoded value. In the API (and maybe in the database?) this should be serialized as `<type>:<value>`, e.g. `sha256:e3b0c44298f...`.
1818
- `source: bool`: whether this was directly uploaded by a user. `false` if it was processed or generated by Opencast.

0 commit comments

Comments
 (0)