You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My intention is to use the Schema both to normalize the data and to obtain default values. In the second case, there is no need to input any data, just obtain an array of default values, if there are any.
My use case
I have several Personas, each of which can have very different parameters (saved as JSON in database).
The structure of these parameters is defined by the Persona's Schema.
I use the Persona's Schema to normalize these parameters entered by user's input.
To create a new Persona, however, I need to generate default values for its parameters from its Schema, so that I do not have to define them separately, because – why not use the existing Schema for this?
I need to use this Schema for normalization, which works great, but also to get the default values that are defined there. I need to get this result from this Schema:
[
'nickname' => 'Maniac',
'skills' => 'low'
]
When creating a new Persona, I encode this into JSON and save into database as default parameters of the Persona.
My idea is to have something like:
// normalized data$normalized = $processor->process($schema, $data);
// default values$defaults = $processor->getDefaults($schema);
// or$defaults = $processor->process($schema); // that is, no input data are specified, so it returns default values instead of normalized data
The text was updated successfully, but these errors were encountered:
Intention
My intention is to use the Schema both to normalize the data and to obtain default values. In the second case, there is no need to input any data, just obtain an array of default values, if there are any.
My use case
I have several Personas, each of which can have very different parameters (saved as JSON in database).
The structure of these parameters is defined by the Persona's Schema.
I use the Persona's Schema to normalize these parameters entered by user's input.
To create a new Persona, however, I need to generate default values for its parameters from its Schema, so that I do not have to define them separately, because – why not use the existing Schema for this?
Example of my Schema for one of the Persona's:
I need to use this Schema for normalization, which works great, but also to get the default values that are defined there. I need to get this result from this Schema:
When creating a new Persona, I encode this into JSON and save into database as default parameters of the Persona.
My idea is to have something like:
The text was updated successfully, but these errors were encountered: