Skip to content

Commit

Permalink
Add JSON spec instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
akpi816218 committed Nov 20, 2024
1 parent 70f8883 commit 3de322c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
24 changes: 24 additions & 0 deletions rawspec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# JSON Specification

This is the raw data for every word in the language.

## Rules

- Do not manually edit these files. Use the `../scripting/index.ts` script to modify them.
- Do not add extra commits to update these files; GitHub Actions will automatically update the rawspec after merging into `main`.

Any faulty changes will be overwritten after merge.

## Schemas

See `../scripting/types.ts` for file schemas.

The complete langspec is simply an array of `Entry` objects; that is to say, when imported or parsed, it resolves to a value of type `Entry[]`.

All the other files (e.g. `nouns.json`, `verbs.json`, etc.) consist of arrays of `Section` objects. If the file has subheaders (Level 2 Markdown headings) then this is used for each `Section.title`. Otherwise, the `Section.title` is `null`, and all entries are kept in the one untitled section.

## Using

Permalink to complete spec: [`https://raw.githubusercontent.com/Transconlang/translang/refs/heads/main/rawspec/0-complete.json`](https://raw.githubusercontent.com/Transconlang/translang/refs/heads/main/rawspec/0-complete.json)

Permalink to individual files: `https://raw.githubusercontent.com/Transconlang/translang/refs/heads/main/rawspec/{{NAME}}.json` where `{{NAME}}` is the name of the file (e.g. `nouns`, `verbs`, etc.).
6 changes: 3 additions & 3 deletions scripting/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* The type of the entry in each separated file (i.e. verbs.json)
*/
export interface Section {
title: string | null;
type: WordType;
headers: string[];
entries: Entry[];
}

/**
* The type of the entry in each separated file (i.e. verbs.json)
*/
export interface Entry {
word: string;
meaning: string;
Expand Down

0 comments on commit 3de322c

Please sign in to comment.