https://github.com/dutchcodingcompany/laravel-json-schema
https://github.com/dutchcodingcompany/laravel-json-schema
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dutchcodingcompany/laravel-json-schema
- Owner: DutchCodingCompany
- License: mit
- Created: 2021-09-07T11:48:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-15T13:44:16.000Z (almost 2 years ago)
- Last Synced: 2025-04-02T20:54:13.198Z (about 1 year ago)
- Language: PHP
- Size: 17.6 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Json Schema
[](https://packagist.org/packages/dutchcodingcompany/laravel-json-schema)
[](https://packagist.org/packages/dutchcodingcompany/laravel-json-schema)
This package makes it easy to use `swaggest/json-schema` in laravel.
## Installation
You can install the package via composer:
```bash
composer require dutchcodingcompany/laravel-json-schema
```
## Usage
1. Create a json schema in the schema directory, eg. `storage/app/schema/example.json`
2. Reference the schema in the validator using one of the rules:
- `new \DutchCodingCompany\LaravelJsonSchema\Rules\JsonSchemaRule('example')`
- `new \DutchCodingCompany\LaravelJsonSchema\Rules\JsonSchemaAttributeRule('type', TypeEnum::class)` (be careful to validate the attribute `type` in this case)
To customize the schema directory, use environment variable `JSON_SCHEMA_DIRECTORY` or publish the config file.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.