commit 432ff5f2b6f8b0e71144f921f8d74336309497b5 Author: Lily Rose Date: Thu Aug 7 20:23:13 2025 +1000 Initial commit diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..1a347a8 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright © 2025 Lily Rose + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5fbdc0 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# JSON Schema Definition for gleam.toml \ No newline at end of file diff --git a/gleam.toml.schema.json b/gleam.toml.schema.json new file mode 100644 index 0000000..2e4ffb4 --- /dev/null +++ b/gleam.toml.schema.json @@ -0,0 +1,600 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://json.schemastore.org/gleam.toml.schema.json", + "title": "gleam.toml", + "description": "A gleam project configuration", + "type": "object", + "x-taplo-info": { + "authors": ["Lily Rose (https://github.com/LilyRose2798)"], + "patterns": ["^(.*(/|\\\\)gleam\\.toml|gleam\\.toml)$"] + }, + "x-tombi-toml-version": "v1.0.0", + "x-tombi-table-keys-order": "schema", + "properties": { + "name": { + "description": "The name of your project", + "type": "string", + "pattern": "[a-z][a-z0-9_]+", + "examples": ["my_project"] + }, + "version": { + "description": "The version of your project", + "type": "string", + "pattern": "^[0-9]+.[0-9]+.[0-9]+(-[0-9A-Za-z-.]+)?(+[0-9A-Za-z-.]+)?$", + "examples": ["1.0.0"] + }, + "gleam_version": { + "description": "The version of gleam to use for the project", + "type": "string", + "pattern": "^[0-9A-Za-z-+=.>~<]+?$", + "examples": [">= 0.30.0", "1.12.0"] + }, + "licenses": { + "description": "The licenses which the project uses, in SPDX format", + "type": "array", + "items": { + "description": "An SPDX license name", + "type": "string", + "examples": ["Apache-2.0", "MIT"] + }, + "examples": [["Apache-2.0", "MIT"]] + }, + "description": { + "description": "A short description of your project", + "type": "string", + "examples": ["Gleam bindings to..."] + }, + "documentation": { + "description": "Documentation specific configuration", + "type": "object", + "properties": { + "pages": { + "description": "Additional markdown pages to be included in generated HTML docs", + "type": "array", + "items": { + "description": "Additional markdown page to be included in generated HTML docs", + "type": "object", + "properties": { + "title": { + "description": "The title of the page", + "type": "string", + "examples": ["My Page"] + }, + "path": { + "description": "The path for the generated html to be output to", + "type": "string", + "examples": ["my-page.html"] + }, + "source": { + "description": "The path where the markdown document is located", + "type": "string", + "examples": ["./path/to/my-page.md"] + } + }, + "additionalProperties": false, + "examples": [ + { + "title": "My Page", + "path": "my-page.html", + "source": "./path/to/my-page.md" + } + ] + }, + "examples": [ + [ + { + "title": "My Page", + "path": "my-page.html", + "source": "./path/to/my-page.md" + } + ] + ] + } + }, + "additionalProperties": false, + "examples": [ + { + "pages": [ + { + "title": "My Page", + "path": "my-page.html", + "source": "./path/to/my-page.md" + } + ] + } + ] + }, + "dependencies": { + "description": "The packages the project needs to compile and run", + "type": "object", + "patternProperties": { + "[a-z][a-z0-9_]+": { + "oneOf": [ + { + "description": "The Hex version requirements for the dependency", + "type": "string", + "examples": [ + ">= 0.18.0 and < 2.0.0", + ">= 0.2.0 and < 2.0.0", + ">= 2.1.0 and < 3.0.0" + ] + }, + { + "description": "A local dependency", + "type": "object", + "properties": { + "path": { + "description": "The path of the local dependency", + "type": "string", + "examples": ["../my_other_project"] + } + }, + "required": ["path"], + "additionalItems": false, + "examples": [{ "path": "../my_other_project" }] + }, + { + "description": "A git dependency", + "type": "object", + "properties": { + "git": { + "description": "The git repository of the dependency", + "type": "string", + "examples": [ + "git@github.com:my-project/my-library.git", + "git@github.com:gleam-lang/stdlib.git" + ] + }, + "ref": { + "description": "The git ref to use for the dependency", + "type": "string", + "examples": ["main", "a8b3c5d82"] + } + }, + "required": ["git", "ref"], + "additionalItems": false, + "examples": [ + { "git": "git@github.com:my-project/my-library.git", "ref": "main" }, + { "git": "git@github.com:gleam-lang/stdlib.git", "ref": "a8b3c5d82" } + ] + } + ], + "examples": [ + ">= 0.18.0 and < 2.0.0", + ">= 0.2.0 and < 2.0.0", + ">= 2.1.0 and < 3.0.0", + { "path": "../my_other_project" }, + { "git": "git@github.com:my-project/my-library.git", "ref": "a8b3c5d82" }, + { "git": "git@github.com:gleam-lang/stdlib.git", "ref": "main" } + ] + } + }, + "additionalProperties": false, + "examples": [ + { + "gleam_stdlib": ">= 0.18.0 and < 2.0.0", + "gleam_erlang": ">= 0.2.0 and < 2.0.0", + "gleam_http": ">= 2.1.0 and < 3.0.0", + "my_other_project": { "path": "../my_other_project" }, + "my_git_library": { "git": "git@github.com:my-project/my-library.git", "ref": "a8b3c5d82" }, + "latest_stdlib": { "git": "git@github.com:gleam-lang/stdlib.git", "ref": "main" } + } + ] + }, + "dev-dependencies": { + "description": "The packages the project needs for the tests", + "type": "object", + "patternProperties": { + "[a-z][a-z0-9_]+": { + "oneOf": [ + { + "description": "The Hex version requirements for the dev dependency", + "type": "string", + "examples": [">= 1.0.0 and < 2.0.0"] + }, + { + "description": "A local dev dependency", + "type": "object", + "properties": { + "path": { + "description": "The path of the local dev dependency", + "type": "string", + "examples": ["../my_other_project"] + } + }, + "required": ["path"], + "additionalItems": false, + "examples": [{ "path": "../my_other_project" }] + }, + { + "description": "A git dev dependency", + "type": "object", + "properties": { + "git": { + "description": "The git repository of the dev dependency", + "type": "string", + "examples": ["git@github.com:my-project/my-testing-library.git"] + }, + "ref": { + "description": "The git ref to use for the dev dependency", + "type": "string", + "examples": ["main", "a8b3c5d82"] + } + }, + "required": ["git", "ref"], + "additionalItems": false, + "examples": [{ "git": "git@github.com:my-project/my-testing-library.git", "ref": "main" }] + } + ], + "examples": [ + ">= 0.18.0 and < 2.0.0", + ">= 0.2.0 and < 2.0.0", + ">= 2.1.0 and < 3.0.0", + { "path": "../my_other_project" }, + { "git": "git@github.com:my-project/my-library.git", "ref": "a8b3c5d82" }, + { "git": "git@github.com:gleam-lang/stdlib.git", "ref": "main" } + ] + } + }, + "additionalProperties": false, + "examples": [ + { + "gleeunit": ">= 1.0.0 and < 2.0.0" + } + ] + }, + "repository": { + "description": "The source code repository location", + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "description": "The type of repository", + "type": "string", + "enum": ["github", "gitlab", "sourcehut", "bitbucket", "codeberg"], + "examples": ["github", "gitlab", "sourcehut", "bitbucket", "codeberg"] + }, + "user": { + "description": "The user that the repository is under", + "type": "string", + "examples": ["example"] + }, + "repo": { + "description": "The repository name", + "type": "string", + "examples": ["my_project"] + }, + "tag_prefix": { + "description": "The tag prefix of the repository", + "type": "string", + "examples": ["v"] + } + }, + "required": ["type", "user", "repo"], + "additionalProperties": false, + "examples": [ + { "type": "github", "user": "example", "repo": "my_project" }, + { "type": "gitlab", "user": "example", "repo": "my_project" }, + { "type": "sourcehut", "user": "example", "repo": "my_project" }, + { "type": "bitbucket", "user": "example", "repo": "my_project" }, + { "type": "codeberg", "user": "example", "repo": "my_project" } + ] + }, + { + "type": "object", + "properties": { + "type": { + "description": "The type of repository", + "type": "string", + "enum": ["forgejo", "gitea"], + "examples": ["forgejo", "gitea"] + }, + "host": { + "description": "The host name of the repository server", + "type": "string", + "examples": ["example.com"] + }, + "user": { + "description": "The user that the repository is under", + "type": "string", + "examples": ["example"] + }, + "repo": { + "description": "The repository name", + "type": "string", + "examples": ["my_project"] + }, + "tag_prefix": { + "description": "The tag prefix of the repository", + "type": "string", + "examples": ["v"] + } + }, + "required": ["type", "host", "user", "repo"], + "additionalItems": false, + "examples": [ + { "type": "forgejo", "host": "example.com", "user": "example", "repo": "my_project" }, + { "type": "gitea", "host": "example.com", "user": "example", "repo": "my_project" } + ] + }, + { + "type": "object", + "properties": { + "type": { + "description": "The type of repository", + "type": "string", + "enum": ["custom"], + "examples": ["custom"] + }, + "url": { + "description": "The url of the repository", + "type": "string", + "examples": ["https://example.com/my_project"] + }, + "tag_prefix": { + "description": "The tag prefix of the repository", + "type": "string", + "examples": ["v"] + } + }, + "required": ["type", "url"], + "additionalItems": false, + "examples": [{ "type": "custom", "url": "https://example.com/my_project" }] + } + ], + "examples": [{ "type": "github", "user": "example", "repo": "my_project" }] + }, + "links": { + "description": "Links to any related website", + "type": "array", + "items": { + "description": "A link to any related website", + "type": "object", + "properties": { + "title": { + "description": "The title of the link", + "type": "string", + "examples": ["Home page", "Other site"] + }, + "href": { + "description": "The url of the link", + "type": "string", + "examples": ["https://example.com", "https://another.example.com"] + } + }, + "additionalProperties": false, + "examples": [ + { "title": "Home page", "href": "https://example.com" }, + { "title": "Other site", "href": "https://another.example.com" } + ] + }, + "examples": [ + [ + { "title": "Home page", "href": "https://example.com" }, + { "title": "Other site", "href": "https://another.example.com" } + ] + ] + }, + "erlang": { + "description": "Erlang specific configuration", + "type": "object", + "properties": { + "application_start_module": { + "description": "The name of the OTP application module, if the project has one", + "type": "string", + "examples": ["my_app/application"] + }, + "extra_applications": { + "description": "The names of any OTP applications that need to be started in addition to the ones from the project dependencies", + "type": "array", + "items": { + "description": "The name of an OTP application", + "type": "string", + "examples": ["inets", "ssl"] + }, + "examples": [["inets", "ssl"]] + } + }, + "additionalProperties": false, + "examples": [ + { + "application_start_module": "my_app/application", + "extra_applications": ["inets", "ssl"] + } + ] + }, + "javascript": { + "description": "JavaScript specific configuration", + "type": "object", + "properties": { + "typescript_declarations": { + "description": "Generate TypeScript .d.ts files", + "type": "boolean", + "examples": [true, false] + }, + "runtime": { + "description": "Which JavaScript runtime to use with `gleam run`, `gleam test` etc.", + "type": "string", + "enum": ["node", "deno", "bun"], + "examples": ["node", "deno", "bun"] + } + }, + "additionalProperties": false, + "examples": [ + { + "typescript_declarations": true, + "runtime": "node" + } + ] + }, + "javascript.deno": { + "description": "Configuration specific to the Deno runtime", + "type": "object", + "properties": { + "allow_all": { + "description": "Whether to allow all permissions", + "type": "boolean", + "examples": [true, false] + }, + "allow_sys": { + "description": "Whether to allow sys permission", + "type": "boolean", + "examples": [true, false] + }, + "allow_ffi": { + "description": "Whether to allow ffi permission", + "type": "boolean", + "examples": [true, false] + }, + "allow_hrtime": { + "description": "Whether to allow hrtime permission", + "type": "boolean", + "examples": [true, false] + }, + "allow_env": { + "description": "The environment variables to allow", + "oneOf": [ + { + "description": "Whether to allow all environment variables", + "type": "boolean", + "examples": [true, false] + }, + { + "description": "A list of environment variables", + "type": "array", + "items": { + "description": "An environment variable", + "type": "string", + "examples": ["DATABASE_URL"] + } + } + ], + "examples": [true, ["DATABASE_URL"]] + }, + "allow_net": { + "description": "The IP addresses or hostnames to allow", + "oneOf": [ + { + "description": "Whether to allow all IP addresses and hostnames", + "type": "boolean", + "examples": [true, false] + }, + { + "description": "A list of IP addresses or hostnames", + "type": "array", + "items": { + "description": "An IP address or hostname", + "type": "string", + "examples": ["example.com:443"] + } + } + ], + "examples": [true, ["example.com:443"]] + }, + "allow_run": { + "description": "The paths allowed to be run", + "oneOf": [ + { + "description": "Whether to allow all paths to be run", + "type": "boolean", + "examples": [true, false] + }, + { + "description": "A list of paths to allow to be run", + "type": "array", + "items": { + "description": "A path", + "type": "string", + "examples": ["./bin/migrate.sh"] + } + } + ], + "examples": [true, ["./bin/migrate.sh"]] + }, + "allow_read": { + "description": "The paths allowed to be read from", + "oneOf": [ + { + "description": "Whether to allow all paths to be read from", + "type": "boolean", + "examples": [true, false] + }, + { + "description": "A list of paths to allow to be read from", + "type": "array", + "items": { + "description": "A path", + "type": "string", + "examples": ["./database.sqlite"] + } + } + ], + "examples": [true, ["./database.sqlite"]] + }, + "allow_write": { + "description": "The paths allowed to be written to", + "oneOf": [ + { + "description": "Whether to allow all paths to be written to", + "type": "boolean", + "examples": [true, false] + }, + { + "description": "A list of paths to allow to be written to", + "type": "array", + "items": { + "description": "A path", + "type": "string", + "examples": ["./database.sqlite"] + } + } + ], + "examples": [true, ["./database.sqlite"]] + }, + "unstable": { + "description": "Whether to use the unstable version of deno", + "type": "boolean", + "examples": [true, false] + }, + "location": { + "description": "The location of the deno runtime executable", + "type": "string", + "examples": ["/usr/bin/deno"] + } + }, + "additionalProperties": false, + "examples": [ + { + "allow_all": false, + "allow_sys": false, + "allow_ffi": false, + "allow_hrtime": false, + "allow_env": ["DATABASE_URL"], + "allow_net": ["example.com:443"], + "allow_run": ["./bin/migrate.sh"], + "allow_read": ["./database.sqlite"], + "allow_write": ["./database.sqlite"] + } + ] + }, + "target": { + "description": "The target to default to when compiling or running Gleam code", + "type": "string", + "enum": ["erlang", "javascript"], + "examples": ["erlang", "javascript"] + }, + "internal_modules": { + "description": "Modules that should be considered \"internal\" and will not be included in generated documentation", + "type": "array", + "items": { + "description": "A module path", + "type": "string", + "examples": ["my_app/internal", "my_app/internal/*"] + }, + "examples": [["my_app/internal", "my_app/internal/*"]] + } + }, + "required": ["name", "version"], + "additionalProperties": false +}