PHPackages                             zepgram/module-json-schema - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. zepgram/module-json-schema

ActiveMagento2-module[Validation &amp; Sanitization](/categories/validation)

zepgram/module-json-schema
==========================

Json Schema Validation for Magento 2

0.2.0(4mo ago)226.0k↓34.2%11MITPHP

Since Nov 5Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/zepgram/module-json-schema)[ Packagist](https://packagist.org/packages/zepgram/module-json-schema)[ RSS](/packages/zepgram-module-json-schema/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (1)

Zepgram JsonSchema
==================

[](#zepgram-jsonschema)

A Magento implementation for validating JSON Structures against a given Schema with support for Schemas of Draft-3 or Draft-4.
Based on  json schema.
For more information about json schema:

Installation
------------

[](#installation)

```
composer require zepgram/module-json-schema
bin/magento module:enable Zepgram_JsonSchema
bin/magento setup:upgrade

```

Guideline
---------

[](#guideline)

1. Add the formatted json-schema in your module, where webservice will be implemented under `/etc/schema` directory.
2. Create a Virtual Class of type `Zepgram\JsonSchema\Model\Validator` and adapt `fileName` and `moduleName` parameters.

Example
-------

[](#example)

**/etc/di.xml**

```

        schema/hello-world-service.json
        Zepgram_HelloWorld

```

**/etc/schema/hello-world-service.json**

```
{
  "type":"array",
  "items":{
    "type":"object",
    "required":[
      "helloId",
      "helloContact"
    ],
    "properties":{
      "helloId":{
        "type":"string",
        "description":"Hello Id"
      },
      "helloContact":{
        "type":"array",
        "items":{
          "type":"object",
          "required":[
            "age",
            "fullName"
          ],
          "properties":{
            "age":{
              "type":"integer",
              "format":"int32",
              "description":"contact age",
              "minimum":-2147483648,
              "maximum":2147483647
            },
            "fullName":{
              "type":"object",
              "required":[
                "firstname",
                "lastname"
              ],
              "properties":{
                "firstname":{
                  "type":"string",
                  "description":"contact firstname"
                },
                "lastname":{
                  "type":"string",
                  "description":"contact lastname"
                }
              }
            }
          }
        }
      }
    }
  },
  "$schema":"http://json-schema.org/draft-04/schema#"
}
```

Open API V3
-----------

[](#open-api-v3)

If your architecture is using open API-V3 to describe web service usage you can convert it to json schema.

1. Install the node utility:
2. Convert the open api yaml file into JSON:
    `openapi2schema -i my-custom-service.yaml | python -m json.tool | jq '."%end_point%".post.body' > my-custom-service.json`
    where `%endpoint%` must be replaced by your api endpoint described in yaml file (e.g.: /v1/customEndPoint)

Issues
------

[](#issues)

If you encountered an issue during installation or with usage, please report it on this github repository.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance77

Regular maintenance activity

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~510 days

Total

4

Last Release

123d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66547185afcb495a48d0dd0defd547999fb057dd042d3615dc95955cffc81b42?d=identicon)[zepgram](/maintainers/zepgram)

---

Top Contributors

[![zepgram](https://avatars.githubusercontent.com/u/16258478?v=4)](https://github.com/zepgram "zepgram (3 commits)")

### Embed Badge

![Health badge](/badges/zepgram-module-json-schema/health.svg)

```
[![Health](https://phpackages.com/badges/zepgram-module-json-schema/health.svg)](https://phpackages.com/packages/zepgram-module-json-schema)
```

###  Alternatives

[ergebnis/json-schema-validator

Provides a JSON schema validator, building on top of justinrainbow/json-schema.

3626.9M7](/packages/ergebnis-json-schema-validator)[dstotijn/yii2-json-schema-validator

A Yii2 extension that provides a validator class for JSON Schema validation.

1730.7k](/packages/dstotijn-yii2-json-schema-validator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
