PHPackages                             hskrasek/openapi-schema-to-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. [API Development](/categories/api)
4. /
5. hskrasek/openapi-schema-to-json-schema

ActiveLibrary[API Development](/categories/api)

hskrasek/openapi-schema-to-json-schema
======================================

PHP library to convert OpenAPI schema objects to JSON Schema

0.2.0(8y ago)32.3k[3 issues](https://github.com/hskrasek/openapi-schema-to-jsonschema/issues)MITPHPPHP &gt;=7.1

Since Jan 31Pushed 8y ago1 watchersCompare

[ Source](https://github.com/hskrasek/openapi-schema-to-jsonschema)[ Packagist](https://packagist.org/packages/hskrasek/openapi-schema-to-json-schema)[ Docs](https://github.com/hskrasek/openapi-schema-to-json-schema)[ RSS](/packages/hskrasek-openapi-schema-to-json-schema/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (3)Dependencies (10)Versions (4)Used By (0)

OpenAPI Schema to JSON Schema Converter
=======================================

[](#openapi-schema-to-json-schema-converter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c5eb56a6f9bb100bff4ccdfce34e69b23dd0f1b55fe0d7d33ab68a5e406650c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68736b726173656b2f6f70656e6170692d736368656d612d746f2d6a736f6e2d736368656d612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hskrasek/openapi-schema-to-json-schema)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d8142d32bd97cb15f8c52a4aa884181e4e6530cda80d1c7a51c80b5cb124decd/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f68736b726173656b2f6f70656e6170692d736368656d612d746f2d6a736f6e736368656d612f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/hskrasek/openapi-schema-to-jsonschema)[![Coverage Status](https://camo.githubusercontent.com/8d73f26ba4cb2ae61a3f0a2694499124fa7f2ca0a3c4ae4d3078ce6b763fec47/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f68736b726173656b2f6f70656e6170692d736368656d612d746f2d6a736f6e736368656d612e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hskrasek/openapi-schema-to-jsonschema/code-structure)[![Quality Score](https://camo.githubusercontent.com/a527fb09c90710bf886a2274b3b9a0d6f4d06cac7dee3158b3ff0c812a97e068/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f68736b726173656b2f6f70656e6170692d736368656d612d746f2d6a736f6e736368656d612e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hskrasek/openapi-schema-to-jsonschema)[![Total Downloads](https://camo.githubusercontent.com/79c192a0400eeff35d37381eb308e052991e4e71177d4612c3aed2c6c318c4a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68736b726173656b2f6f70656e6170692d736368656d612d746f2d6a736f6e2d736368656d612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hskrasek/openapi-schema-to-json-schema)

This is PHP port of the [Node package](https://github.com/mikunn/openapi-schema-to-json-schema) by the same name, so huge props to Github user [mikunn](https://github.com/mikunn) for the work he did. This package currently converts from [OpenAPI 3.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md) to [JSON Schema Draft 4](http://json-schema.org/specification-links.html#draft-4).

Features
--------

[](#features)

- converts OpenAPI 3.0 Schema Object to JSON Schema Draft 4
- converts [common named data types](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types) to `type` and `format`
    - for example `type: "dateTime"` becomes `type: "string"` with `format: "date-time"`
- deletes `nullable` and adds `"null"` to `type` array if `nullable` is `true`
- supports deep structures with nested `allOf`s etc.
- removes [OpenAPI specific properties](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#fixed-fields-20) such as `discriminator`, `deprecated` etc. unless specified otherwise
- optionally supports `patternProperties` with `x-patternProperties` in the Schema Object

**NOTE**: `$ref`s are not dereferenced. Use a dereferencer such as [json-schema-ref-parser](https://www.npmjs.com/package/json-schema-ref-parser) prior to using this package.

Install
-------

[](#install)

Via Composer

```
$ composer require hskrasek/openapi-schema-to-json-schema
```

Usage
-----

[](#usage)

```
vendor/bin/oas-to-jsonschema convert docs/schemas docs/specs
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Hunter Skrasek](https://github.com/hskrasek)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~4 days

Total

3

Last Release

3021d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9611296aa629f6c3fe02f8434ea70dc38d034d0c51985b362a66c8a293529cfc?d=identicon)[hskrasek](/maintainers/hskrasek)

---

Top Contributors

[![hskrasek](https://avatars.githubusercontent.com/u/787487?v=4)](https://github.com/hskrasek "hskrasek (38 commits)")

---

Tags

jsonschemaconvertopenapiconverter

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/hskrasek-openapi-schema-to-json-schema/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[api-platform/symfony

Symfony API Platform integration

323.2M67](/packages/api-platform-symfony)

PHPackages © 2026

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