{"id":19526008,"url":"https://github.com/marvelapp/prototype-event-schema","last_synced_at":"2025-10-07T09:25:07.802Z","repository":{"id":203857187,"uuid":"170520971","full_name":"marvelapp/prototype-event-schema","owner":"marvelapp","description":"Prototype player event schema files distributed via yarn \u0026 pip.","archived":false,"fork":false,"pushed_at":"2025-02-10T12:14:03.000Z","size":52,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-17T15:58:52.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://circleci.com/gh/marvelapp/workflows/prototype-event-schema","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marvelapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-02-13T14:24:50.000Z","updated_at":"2025-02-10T12:14:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"33e9a9f7-8c03-4980-8ae7-9cb0932a1b5a","html_url":"https://github.com/marvelapp/prototype-event-schema","commit_stats":null,"previous_names":["marvelapp/prototype-event-schema"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvelapp%2Fprototype-event-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvelapp%2Fprototype-event-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvelapp%2Fprototype-event-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvelapp%2Fprototype-event-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marvelapp","download_url":"https://codeload.github.com/marvelapp/prototype-event-schema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240777554,"owners_count":19855856,"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":[],"created_at":"2024-11-11T01:07:56.234Z","updated_at":"2025-10-07T09:25:02.768Z","avatar_url":"https://github.com/marvelapp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proto-Viewer Event Schema [![CircleCI](https://circleci.com/gh/marvelapp/prototype-event-schema.svg?style=svg\u0026circle-token=88a10b5a479c4c27990a4ce9cf7412eb1ea28ce4)](https://circleci.com/gh/marvelapp/prototype-event-schema)\n\nThis repo defines a set of [json-schema](https://json-schema.org/) (draft v7) files we can use across multiple codebases to validate our prototype-viewer's event schema.\n\n## How to validate event structure\n\nWhen you receive an event, you should first validate the entire event against the schema in `event.json`. That schema will ensure the basic event structure is correct, and that it has all required top level keys with correct `type` values if appropriate.\n\nIf that's valid, you need to take object in the `trigger` key and validate it against the schema in `triggers/:type.json`, where `:type` is the value of the trigger's `type` key. Then you should do the same for the `object` and `outcome` keys.\n\nFor example, if you have an event that looks like the following:\n\n\n```json\n{\n    \"trigger\": {\n        \"type\": \"timer\",\n    },\n    \"object\": {\n        \"type\": \"screen\",\n        \"id\": 1,\n        \"height\": 100,\n        \"width\": 100\n    },\n    \"outcome\": {\n        \"type\": \"screenTransition\",\n        \"fromScreen\": 1,\n        \"toScreen\": 2,\n        \"animation\": \"fade\"\n    },\n    \"timestamp\": 2500,\n    \"id\": \"6503601444799647744\",\n    \"prevId\": \"6503601444803842048\"\n}\n```\n\nAfter validating the entire event using `event.json`, you'd need to take the `trigger` object and validate against `triggers/timer.json`, use `objects/screen.json` to validate the `object` value and validate the `outcome` with `outcomes/screenTransition.json`\n\n## How to add a new `trigger`, `object` or `outcome`\n\nProTip: [jsonschema.net](https://www.jsonschema.net/) is a useful tool for creating and updating the schema files\n\n1. Update `event.json` to accept your new `type` value for the `trigger`, `object` or `outcome` keys as appropriate\n2. Add a schema file to the `triggers/`, `objects/` or `outcomes/` directory, with the same name as your `type` value. So a `timer` type becomes `timer.json`\n3. Add or update at least a basic test in `validate.js`\n\n## How to publish changes\n\n- Alter package.json version and increment depending on whether it is a patch, minor or major change\n- run `npm publish` to update the published npm package\n- update `setup.py` and alter the `version`\n- To publish the python package, run a git tag. `git tag v3.x.x` to the specific version you want to tag. Alter the referenced python package in requirements.txt as required. (e.g. git+https://github.com/marvelapp/prototype-event-schema.git@v3.0.7#egg=marvel-proto-events)\n\n  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarvelapp%2Fprototype-event-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarvelapp%2Fprototype-event-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarvelapp%2Fprototype-event-schema/lists"}