flux-eco / json-schema-instance
Makes a json schema instance for the transmitted values and schema
Installs: 85
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:flux-app
Requires
- php: >=8.0
- ext-json: *
- ext-yaml: *
README
This component is supposed to make a json schema instance for the transmitted values and schema.
help and support with the development very welcome :-)
https://json-schema.org/specification.html
The following example application demonstrates the usage: https://github.com/flux-caps/todo-app
Usage
account.yaml
title: account
type: object
aggregateRootNames:
- account
properties:
personId:
type: number
firstname:
type: string
lastname:
type: string
email:
type: string
type:
type: string
lastChanged:
type: string
getAndPrintSchemaInstance.php
$schema = yaml_parse(file_get_contents('account.yaml'));
$schemaInstance = fluxJsonSchemaInstance\getSchemaInstance('Emmett', $schema['properties']['firstname']);
print_r($schemaInstance);
$schemaInstance = fluxJsonSchemaInstance\getSchemaInstance('123', $schema['properties']['personId']);
print_r($schemaInstance);
outputs
Array
(
[value] => Emmett
[describedBy] => {"type":"string"}
)
Array
(
[value] => 123
[describedBy] => {"type":"number"}
)
Contributing 💜
Please ...
- ... register an account at https://git.fluxlabs.ch
- ... create pull requests 🔥
Adjustment suggestions / bug reporting 🐾
Please ...
- ... register an account at https://git.fluxlabs.ch
- ... ask us for a Service Level Agreement: support@fluxlabs.ch 😘
- ... read and create issues