2017 © Pedro Peláez
 

library openapi-schema-to-json-schema

PHP library to convert OpenAPI schema objects to JSON Schema

image

hskrasek/openapi-schema-to-json-schema

PHP library to convert OpenAPI schema objects to JSON Schema

  • Thursday, February 8, 2018
  • by hskrasek
  • Repository
  • 1 Watchers
  • 1 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 367 % Grown

The README.md

OpenAPI Schema to JSON Schema Converter

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score ![Total Downloads][ico-downloads], (*1)

This is PHP port of the Node package by the same name, so huge props to Github user mikunn for the work he did. This package currently converts from OpenAPI 3.0 to JSON Schema Draft 4., (*2)

Features

  • converts OpenAPI 3.0 Schema Object to JSON Schema Draft 4
  • converts common named 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 allOfs etc.
  • removes OpenAPI specific properties such as discriminator, deprecated etc. unless specified otherwise
  • optionally supports patternProperties with x-patternProperties in the Schema Object

NOTE: $refs are not dereferenced. Use a dereferencer such as json-schema-ref-parser prior to using this package., (*3)

Install

Via Composer, (*4)

``` bash $ composer require hskrasek/openapi-schema-to-json-schema, (*5)


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

Change log

Please see CHANGELOG for more information on what has changed recently., (*6)

Testing

bash $ composer test, (*7)

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*8)

Security

If you discover any security related issues, please email hunterskrasek@me.com instead of using the issue tracker., (*9)

Credits

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions