blacksmith generate model
This command generates a JSON Schema allowing to validate data against the generated model.
Example:
$ blacksmith generate model \
--name user \
--path ./models
Generating files:
-> Generating model at ./models
Success!
Required flags
-
--name [name]
: Set the name of the model. It shall be a valid name only containing lowercase letters (a-z
), underscores (_
), and dashes (-
).Aliases:
-n [name]
Example:
$ blacksmith generate model \ --name user
Optional flags
-
--extend [resource]
: Generate a model extending the JSON schema of a Blacksmith resource. This flag allows to extend / inherit from a specific resource without maintaining the internal schema of the Blacksmith resource.Values:
trigger/cdc
: Extends the JSON schema returned by the Extraction of a trigger in modecdc
.trigger/http_client
: Extends the JSON schema returned by the Extraction of a trigger in modehttp_client
.trigger/http_endpoint
: Extends the JSON schema returned by the Extraction of a trigger in modehttp_endpoint
.trigger/subscription
: Extends the JSON schema returned by the Extraction of a trigger in modesubscription
.
Example:
$ blacksmith generate model \ --name user \ --extend trigger/http_endpoint
-
--path [path]
: Relative path where the model's file will be generated. If the directories don't exist, they will automatically be created (if possible). If files already exist at the path with the same name of the ones generated by the CLI, an error will be prompted. The CLI will never override existing files.Aliases:
-p [path]
Example:
$ blacksmith generate model \ --name user \ --path ./models
If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the repository. Once we merge it, the changes will be reflected on the website the next time it is deployed.
Thank you for your contributions!