{"id":20800217,"url":"https://github.com/zepgram/module-json-schema","last_synced_at":"2025-12-24T14:28:32.884Z","repository":{"id":57090024,"uuid":"424763472","full_name":"zepgram/module-json-schema","owner":"zepgram","description":"A Magento implementation for validating JSON Structures against a given Schema","archived":false,"fork":false,"pushed_at":"2022-04-01T21:59:46.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-25T16:40:53.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/zepgram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-04T22:58:59.000Z","updated_at":"2021-11-05T02:00:27.000Z","dependencies_parsed_at":"2022-08-20T16:00:53.179Z","dependency_job_id":null,"html_url":"https://github.com/zepgram/module-json-schema","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zepgram%2Fmodule-json-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zepgram%2Fmodule-json-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zepgram%2Fmodule-json-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zepgram%2Fmodule-json-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zepgram","download_url":"https://codeload.github.com/zepgram/module-json-schema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243147274,"owners_count":20243744,"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-17T18:12:56.222Z","updated_at":"2025-12-24T14:28:32.870Z","avatar_url":"https://github.com/zepgram.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zepgram JsonSchema\n\nA Magento implementation for validating JSON Structures against a given Schema with support for Schemas of Draft-3 or Draft-4.\u003cbr\u003e\nBased on https://github.com/justinrainbow/json-schema json schema.\u003cbr\u003e\nFor more information about json schema: http://json-schema.org/\n\n## Installation\n```\ncomposer require zepgram/module-json-schema\nbin/magento module:enable Zepgram_JsonSchema\nbin/magento setup:upgrade\n```\n\n## Guideline\n\n1. Add the formatted json-schema in your module, where webservice will be implemented under `/etc/schema` directory.\n2. Create a Virtual Class of type `Zepgram\\JsonSchema\\Model\\Validator` and adapt `fileName` and `moduleName` parameters.\n\n## Example\n\n**/etc/di.xml**\n```xml\n\u003cvirtualType name=\"HelloWorldValidator\" type=\"Zepgram\\JsonSchema\\Model\\Validator\"\u003e\n    \u003carguments\u003e\n        \u003cargument name=\"fileName\" xsi:type=\"string\"\u003eschema/hello-world-service.json\u003c/argument\u003e\n        \u003cargument name=\"moduleName\" xsi:type=\"string\"\u003eZepgram_HelloWorld\u003c/argument\u003e\n    \u003c/arguments\u003e\n\u003c/virtualType\u003e\n```\n\n**/etc/schema/hello-world-service.json**\n```json\n{\n  \"type\":\"array\",\n  \"items\":{\n    \"type\":\"object\",\n    \"required\":[\n      \"helloId\",\n      \"helloContact\"\n    ],\n    \"properties\":{\n      \"helloId\":{\n        \"type\":\"string\",\n        \"description\":\"Hello Id\"\n      },\n      \"helloContact\":{\n        \"type\":\"array\",\n        \"items\":{\n          \"type\":\"object\",\n          \"required\":[\n            \"age\",\n            \"fullName\"\n          ],\n          \"properties\":{\n            \"age\":{\n              \"type\":\"integer\",\n              \"format\":\"int32\",\n              \"description\":\"contact age\",\n              \"minimum\":-2147483648,\n              \"maximum\":2147483647\n            },\n            \"fullName\":{\n              \"type\":\"object\",\n              \"required\":[\n                \"firstname\",\n                \"lastname\"\n              ],\n              \"properties\":{\n                \"firstname\":{\n                  \"type\":\"string\",\n                  \"description\":\"contact firstname\"\n                }, \n                \"lastname\":{\n                  \"type\":\"string\",\n                  \"description\":\"contact lastname\"\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  },\n  \"$schema\":\"http://json-schema.org/draft-04/schema#\"\n}\n```\n\n## Open API V3\n\nIf your architecture is using open API-V3 to describe web service usage you can convert it to json schema.\n1. Install the node utility: https://github.com/mikunn/openapi2schema\n2. Convert the open api yaml file into JSON:\u003cbr\u003e\n  `openapi2schema -i my-custom-service.yaml | python -m json.tool | jq '.\"%end_point%\".post.body' \u003e my-custom-service.json`\u003cbr\u003e\nwhere `%endpoint%` must be replaced by your api endpoint described in yaml file (e.g.: /v1/customEndPoint)\n\n## Issues\n\nIf you encountered an issue during installation or with usage, please report it on this github repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzepgram%2Fmodule-json-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzepgram%2Fmodule-json-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzepgram%2Fmodule-json-schema/lists"}