Skip to content

Makes a json schema instance for the transmitted values and schema

License

Notifications You must be signed in to change notification settings

flux-eco/json-schema-instance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flux-eco/json-schema-instance

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 ...

  1. ... register an account at https://git.fluxlabs.ch
  2. ... create pull requests 🔥

Adjustment suggestions / bug reporting 🐾

Please ...

  1. ... register an account at https://git.fluxlabs.ch
  2. ... ask us for a Service Level Agreement: [email protected] 😘
  3. ... read and create issues

About

Makes a json schema instance for the transmitted values and schema

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages