Download the PHP package cyve/json-schema-form-bundle without Composer
On this page you can find all versions of the php package cyve/json-schema-form-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cyve/json-schema-form-bundle
More information about cyve/json-schema-form-bundle
Files in cyve/json-schema-form-bundle
Package json-schema-form-bundle
Short Description Create Symfony forms from JSON schema
License MIT
Informations about the package json-schema-form-bundle
JsonSchemaFormBundle
Creates a Symfony form from a JSON schema.
Installation:
With Composer:
Usage
The form option data_schema
MUST be an object
representing a JSON schema.
Documentation
Form generation
JSON schema property | Symfony FormType | Form options |
---|---|---|
type: "*" and enum: [*] |
ChoiceType |
choices is set with the content of enum |
type: "array" |
CollectionType |
allow_add , allow_delete and delete_empty are set to true . entry_type and entry_options are resolved from the items sub-schema |
type: "object" |
SchemaType |
data_schema is set with the object sub-schema |
type: "integer" |
IntegerType |
|
type: "number" |
NumberType |
|
type: "boolean" |
CheckboxType |
|
type: "string" and format: "date-time" |
DateTimeType |
input_format is set to "c" (ISO 8601) |
type: "string" and format: "date" |
DateType |
input_format is set to "Y-m-d" |
type: "string" and format: "time" |
TimeType |
input_format is set to "H:i:s" |
type: "string" and format: "email" |
EmailType |
|
type: "string" and format: "uri" |
UrlType |
|
type: "null" |
null |
The form option label
is set with JSON property title
if defined
The form option help
is set with JSON property description
if defined
The form option empty_data
is set with JSON property default
if defined
Validation
To validate the form subject against the JSON schema, add the form option 'constraints' => [new Cyve\JsonSchemaFormBundle\Validator\Constraint\Schema($schema)]
to the root form. The validator uses propertyPath
to display the violation messages on the proper fields.
The JSON schema validation is made using justinrainbow/json-schema.
See the JSON schema specification
All versions of json-schema-form-bundle with dependencies
justinrainbow/json-schema Version ^5.0
symfony/form Version ^4.0|^5.0
symfony/validator Version ^4.0|^5.0
symfony/options-resolver Version ^4.0|^5.0