Skip to content

Commit

Permalink
Mit's in the dictionary
Browse files Browse the repository at this point in the history
that said, it erge branch 'feature/split' of github.com:lipu-linku/sona into feature/split
  • Loading branch information
gregdan3 committed Dec 2, 2023
2 parents 8443582 + aeb7677 commit 6983d75
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 141 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/generate_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ permissions:
jobs:
generate:
runs-on: ubuntu-latest
name: Generate JSON schemas from Zod schemas
defaults:
run:
working-directory: ./schemas
outputs:
schema_changed: ${{ steps.commit.outputs.committed }}
commit_sha: ${{ steps.commit.outputs.commit_long_sha }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -35,6 +39,15 @@ jobs:
run: pnpm run generate:schemas

- name: Commit schemas
id: commit
uses: EndBug/add-and-commit@v9
with:
message: "Generated schemas for ${{ github.event.pull_request.head.sha || github.event.head_commit.id || vars.GITHUB_SHA }}"

validate:
name: Validate TOMLs based on schema
needs: generate
uses: ./.github/workflows/validate_toml.yml
with:
commit_sha: ${{ needs.generate.outputs.commit_sha }}
if: ${{ needs.generate.outputs.schema_changed == 'true' }}
14 changes: 7 additions & 7 deletions .github/workflows/validate_toml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
paths:
- "**.toml"
- "schemas/generated/**.json"
pull_request:
paths:
- "**.toml"
- "schemas/generated/**.json"
workflow_call:
inputs:
commit_sha:
type: string
required: true
workflow_dispatch:

permissions:
Expand All @@ -17,7 +17,7 @@ permissions:
jobs:
validate:
env:
BranchRef: ${{ github.event.pull_request.head.sha || github.event.head_commit.id || vars.GITHUB_SHA || 'main' }}
BranchRef: ${{ github.event_name == 'workflow_run' && inputs.commit_sha || github.sha }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -36,4 +36,4 @@ jobs:
run: npx --yes @taplo/cli check --schema https://raw.githubusercontent.com/lipu-linku/sona/$BranchRef/schemas/generated/sitelen_pona_translation.json ./translations/**/sp_etymology.toml

- name: Validate word files
run: npx --yes @taplo/cli check --schema https://raw.githubusercontent.com/lipu-linku/sona/$CommitHash/schemas/generated/word.json ./words/*.toml
run: npx --yes @taplo/cli check --schema https://raw.githubusercontent.com/lipu-linku/sona/$BranchRef/schemas/generated/word.json ./words/*.toml
29 changes: 11 additions & 18 deletions schemas/generated/commentary_translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@
"$ref": "#/definitions/commentary_translation",
"definitions": {
"commentary_translation": {
"allOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "a file path pointing to this JSON schema"
}
},
"required": [
"$schema"
]
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "a file path pointing to this JSON schema"
}
},
"required": [
"$schema"
],
"additionalProperties": {
"type": "string"
},
"description": "Localized commentary regarding Toki Pona words"
}
},
Expand Down
29 changes: 11 additions & 18 deletions schemas/generated/definition_translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@
"$ref": "#/definitions/definition_translation",
"definitions": {
"definition_translation": {
"allOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "a file path pointing to this JSON schema"
}
},
"required": [
"$schema"
]
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "a file path pointing to this JSON schema"
}
},
"required": [
"$schema"
],
"additionalProperties": {
"type": "string"
},
"description": "Localized definitions of Toki Pona words"
}
},
Expand Down
53 changes: 23 additions & 30 deletions schemas/generated/etymology_translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,36 @@
"$ref": "#/definitions/etymology_translation",
"definitions": {
"etymology_translation": {
"allOf": [
{
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"definition": {
"type": "string",
"description": "The localized definition of the root word in its origin language"
},
"language": {
"type": "string",
"description": "The localized name of the language this word originated from"
}
},
"required": [
"language"
],
"additionalProperties": false
}
}
},
{
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "a file path pointing to this JSON schema"
}
},
"required": [
"$schema"
],
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"$schema": {
"definition": {
"type": "string",
"description": "The localized definition of the root word in its origin language"
},
"language": {
"type": "string",
"description": "a file path pointing to this JSON schema"
"description": "The localized name of the language this word originated from"
}
},
"required": [
"$schema"
]
"language"
],
"additionalProperties": false
}
],
},
"description": "Localized etymological values for Toki Pona words"
}
},
Expand Down
29 changes: 11 additions & 18 deletions schemas/generated/sitelen_pona_translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@
"$ref": "#/definitions/sitelen_pona_translation",
"definitions": {
"sitelen_pona_translation": {
"allOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "a file path pointing to this JSON schema"
}
},
"required": [
"$schema"
]
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "a file path pointing to this JSON schema"
}
},
"required": [
"$schema"
],
"additionalProperties": {
"type": "string"
},
"description": "Localized descriptions of the origins of the sitelen pona glyphs for Toki Pona words"
}
},
Expand Down
47 changes: 39 additions & 8 deletions schemas/generated/word.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@
"type": "object",
"properties": {
"sitelen_emosi": {
"type": "string",
"pattern": "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
"anyOf": [
{
"type": "string",
"pattern": "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$"
},
{
"type": "string",
"const": ""
}
],
"description": "The sitelen emosi representation of this word, a script for writing Toki Pona using emoji"
},
"sitelen_pona": {
Expand All @@ -75,18 +83,37 @@
"description": "A list of sitelen Lasina representations of this word, to be converted into sitelen pona glyphs"
},
"sitelen_sitelen": {
"type": "string",
"format": "uri",
"anyOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "string",
"const": ""
}
],
"description": "A URL pointing to an image of this word's sitelen sitelen hieroglyphic block"
},
"ucsur": {
"type": "string",
"pattern": "^U\\+[\\da-fA-F]{4,6}$",
"anyOf": [
{
"type": "string",
"pattern": "^U\\+[\\da-fA-F]{4,6}$"
},
{
"type": "string",
"const": ""
}
],
"description": "The word's UCSUR codepoint, as defined in https://www.kreativekorp.com/ucsur/charts/sitelen.html"
}
},
"required": [
"sitelen_pona"
"sitelen_emosi",
"sitelen_pona",
"sitelen_sitelen",
"ucsur"
],
"additionalProperties": false,
"description": "Ways of representing this word in the real world, via text/computers"
Expand Down Expand Up @@ -190,11 +217,15 @@
},
"required": [
"$schema",
"author_verbatim",
"author_verbatim_source",
"book",
"coined_era",
"ku_data",
"coined_year",
"creator",
"see_also",
"representations",
"source_language",
"usage_category",
"word",
"etymology",
Expand Down
Loading

0 comments on commit 6983d75

Please sign in to comment.