{"id":16916481,"url":"https://github.com/extremeheat/protodef-yaml","last_synced_at":"2025-10-25T03:35:40.916Z","repository":{"id":46198894,"uuid":"336727805","full_name":"extremeheat/protodef-yaml","owner":"extremeheat","description":"Transforms YAML-like syntax to ProtoDef JSON schema and HTML documentation","archived":false,"fork":false,"pushed_at":"2024-12-10T22:07:30.000Z","size":477,"stargazers_count":3,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T22:11:19.038Z","etag":null,"topics":["json","protodef"],"latest_commit_sha":null,"homepage":"https://extremeheat.github.io/protodef-yaml/editor/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/extremeheat.png","metadata":{"files":{"readme":"docs/README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-07T07:25:58.000Z","updated_at":"2024-12-10T22:07:07.000Z","dependencies_parsed_at":"2024-12-10T18:25:39.918Z","dependency_job_id":"8992f881-d1d8-40d4-9da4-4441d5df9381","html_url":"https://github.com/extremeheat/protodef-yaml","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extremeheat%2Fprotodef-yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extremeheat%2Fprotodef-yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extremeheat%2Fprotodef-yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extremeheat%2Fprotodef-yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/extremeheat","download_url":"https://codeload.github.com/extremeheat/protodef-yaml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245140724,"owners_count":20567435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","protodef"],"created_at":"2024-10-13T19:27:55.400Z","updated_at":"2025-10-25T03:35:35.883Z","avatar_url":"https://github.com/extremeheat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protodef-yaml\n[![NPM version](https://img.shields.io/npm/v/protodef-yaml.svg)](http://npmjs.com/package/protodef-yaml)\n[![Build Status](https://github.com/extremeheat/protodef-yaml/workflows/CI/badge.svg)](https://github.com/extremeheat/protodef-yaml/actions?query=workflow%3A%22CI%22)\n[![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8)\n[![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/extremeheat/protodef-yaml)\n\nTransforms YAML-like syntax to ProtoDef JSON schema and HTML documentation. [See a live demo!](https://extremeheat.github.io/protodef-yaml/editor/)\n\n### Usage\n\n```sh\nnpm install -g protodef-yaml\nprotodef-yaml \u003cinput yaml file\u003e \u003coutput json file\u003e # generate json\nprotodef-yaml \u003cinput yaml file\u003e \u003coutput html file\u003e # generate docs\n```\n\nor through npx,\n```\nnpx protodef-yaml input.yml\nnpx protodef-yaml input.yml docs.html\n```\n\n### API\n\nSee [API.md](./API.md)\n\n### Syntax\nRefer to [this documentation](https://github.com/PrismarineJS/bedrock-protocol/blob/master/docs/CONTRIBUTING.md#packet-serialization), also see test/ for example files.\n\nExample input:\n\n```yaml\nScoreEntries:\n   type: u8 =\u003e\n      0: change\n      1: remove\n   entries: []varint\n      scoreboard_id: zigzag64\n      objective_name: string\n      score: li32\n      optional?: bool\n      _: type?\n         if remove:\n            entry_type: i8 =\u003e\n               1: player\n               2: entity\n               3: fake_player\n            _: entry_type?\n               if player or entity:\n                  entity_unique_id: zigzag64\n               if fake_player:\n                  custom_name: string\n```\n\n**Output**\n\u003cdetails\u003e\n\u003csummary\u003eClick to see JSON\u003c/summary\u003e\n\n```json\n{\n  \"ScoreEntries\": [\n    \"container\",\n    [\n      {\n        \"name\": \"type\",\n        \"type\": [\n          \"mapper\",\n          {\n            \"type\": \"u8\",\n            \"mappings\": {\n              \"0\": \"change\",\n              \"1\": \"remove\"\n            }\n          }\n        ]\n      },\n      {\n        \"name\": \"entries\",\n        \"type\": [\n          \"array\",\n          {\n            \"countType\": \"varint\",\n            \"type\": [\n              \"container\",\n              [\n                {\n                  \"name\": \"scoreboard_id\",\n                  \"type\": \"zigzag64\"\n                },\n                {\n                  \"name\": \"objective_name\",\n                  \"type\": \"string\"\n                },\n                {\n                  \"name\": \"score\",\n                  \"type\": \"li32\"\n                },\n                {\n                  \"name\": \"optional\",\n                  \"type\": [\n                    \"option\",\n                    \"bool\"\n                  ]\n                },\n                {\n                  \"anon\": true,\n                  \"type\": [\n                    \"switch\",\n                    {\n                      \"compareTo\": \"../type\",\n                      \"fields\": {\n                        \"remove\": [\n                          \"container\",\n                          [\n                            {\n                              \"name\": \"entry_type\",\n                              \"type\": [\n                                \"mapper\",\n                                {\n                                  \"type\": \"i8\",\n                                  \"mappings\": {\n                                    \"1\": \"player\",\n                                    \"2\": \"entity\",\n                                    \"3\": \"fake_player\"\n                                  }\n                                }\n                              ]\n                            },\n                            {\n                              \"anon\": true,\n                              \"type\": [\n                                \"switch\",\n                                {\n                                  \"compareTo\": \"entry_type\",\n                                  \"fields\": {\n                                    \"player\": [\n                                      \"container\",\n                                      [\n                                        {\n                                          \"name\": \"entity_unique_id\",\n                                          \"type\": \"zigzag64\"\n                                        }\n                                      ]\n                                    ],\n                                    \"entity\": [\n                                      \"container\",\n                                      [\n                                        {\n                                          \"name\": \"entity_unique_id\",\n                                          \"type\": \"zigzag64\"\n                                        }\n                                      ]\n                                    ],\n                                    \"fake_player\": [\n                                      \"container\",\n                                      [\n                                        {\n                                          \"name\": \"custom_name\",\n                                          \"type\": \"string\"\n                                        }\n                                      ]\n                                    ]\n                                  },\n                                  \"default\": \"void\"\n                                }\n                              ]\n                            }\n                          ]\n                        ]\n                      },\n                      \"default\": \"void\"\n                    }\n                  ]\n                }\n              ]\n            ]\n          }\n        ]\n      }\n    ]\n  ]\n}\n```\n\u003c/details\u003e\n\n### Info\n\nThe differences to YAML:\n* parent nodes with children can have a value\n* keys starting with '!' are ignored in the final output\n\nYou can also embed JSON for custom ProtoDef types as usual as YAML is a superset of JSON, for example:\n\n```yaml\nstring: [\"pstring\", {\"countType\": \"i32\"}]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextremeheat%2Fprotodef-yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextremeheat%2Fprotodef-yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextremeheat%2Fprotodef-yaml/lists"}