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
JSON schema permits the passing of default values; these could be used to generate baseline JSON data.
Currently, this feature is not supported, evident by following message:
While not a deal-breaker this could potentially make life easier, when using JSON as an application configuration language, by providing an automated method of providing a baseline configuration for the application at build time.
Currently, providing default config files would mean either
waiting for the application to compile and dump the config (with/without sane defaults) on the target
manually writing JSON and hoping to remember to update it when the schema changes
This is especially prominent when cross-compiling, where it'd be more effort than it's worth to create an intermediate application in the build pipeline, who's only purpose is to generate a default configuration.
Proposed behaviour would be that Quicktype generates a valid JSON file with configured defaults, null where applicable or throws an error message if no default value can be assigned.
Solution
A potential (Quick and Dirty) solution may be to utilise the class generator for Typescript, parse the schema and output a serialised object.
For this solution to work, Quicktype would need to respect default values - this is currently (at least with C++) not the case.
The text was updated successfully, but these errors were encountered:
JSON schema permits the passing of default values; these could be used to generate baseline JSON data.
Currently, this feature is not supported, evident by following message:
Context (Input, Language)
Input Format: JSON schema
Output Language: JSON
Description
While not a deal-breaker this could potentially make life easier, when using JSON as an application configuration language, by providing an automated method of providing a baseline configuration for the application at build time.
Currently, providing default config files would mean either
This is especially prominent when cross-compiling, where it'd be more effort than it's worth to create an intermediate application in the build pipeline, who's only purpose is to generate a default configuration.
Current Behaviour / Output
Proposed Behaviour / Output
Proposed behaviour would be that Quicktype generates a valid JSON file with configured defaults, null where applicable or throws an error message if no default value can be assigned.
Solution
A potential (Quick and Dirty) solution may be to utilise the class generator for Typescript, parse the schema and output a serialised object.
For this solution to work, Quicktype would need to respect default values - this is currently (at least with C++) not the case.
The text was updated successfully, but these errors were encountered: