Adds a new entity and all associated files to your project.
This command can add one or more new entities to your Wrapt project using a formatted yaml or json file.
The input file uses a simplified format from the new:api command that only requires a list of one or more entities.
craftsman add:entity [options] <filepath>| Argument | Description |
|---|---|
| filepath | The full filepath for the yaml or json file that lists the new entities that you want to add to your API. |
| Option | Description |
|---|---|
| -h, --help | Display help message. No filepath is needed to display the help message. |
craftsman add:entity -h
craftsman add:entity C:\fullpath\newentity.yaml
craftsman add:entity C:\fullpath\newentity.yml
craftsman add:entity C:\fullpath\newentity.jsonFirst, you'll want to create a yaml or json file that describes the new entity. This is pretty much the same as the
file we made for our new:api command, but now, the only required section is the Entities section. Just create a list of one or more entities, and you're good to go. For example:
Entities:
- Name: Supplier
Properties:
- Name: SupplierId
IsPrimaryKey: true
Type: int
CanFilter: true
CanSort: true
- Name: Name
Type: string
CanFilter: true
CanSort: true
- Name: EmployeeCount
Type: int?
CanFilter: true
CanSort: true
- Name: CreationDate
Type: datetime?
CanFilter: true
CanSort: true
- Name: SupplierType
Type: int?
CanFilter: true
CanSort: trueTo actually add the entity, you'll want to cd into whatever directory your API solution is located at.
cd C:\MyFull\RepoPath\HereThen, we just need to add our yaml or json path to our craftsman add:entity command:
craftsman add:entity C:\Users\Paul\Documents\ApiConfigs\supplier-entity.yaml👀 Docs Feedback
See something missing or light in content in the docs? Let me know! I want the Wrapt docs to be as through and helpful as possible!
If you'd like to request a new feature, you can submit a new Craftsman issue.