Skip to content

Template#

A Template defines the structure for generating content. It facilitates the automation and simplification of repetitive tasks using tokens to create templates. Similar to Resources, Templates do not have a describe command. Templates can be defined and managed using YAML configuration files. They can be specified globally or within a workspace. Global Templates are accessible throughout the entire application, while workspace-specific Templates are only available within their respective workspaces.

Key Features of a Template#

  • Content Generation: Defines the structure for generating content.
  • Token Usage: Automates repetitive tasks using tokens in templates.
  • YAML Configuration: Templates are defined and managed through YAML files.
  • Scope: Can be defined globally or within a specific workspace.

Example YAML Configuration#

A typical Template configuration in YAML might look like this:

Type: Template
Kind: File
Name: ResponseDto
MetaData:
Specifications:
  Name: LibraryData
  Output: '{{.Resource.Name}}.json'
  Set: EShopping
  Workspace: MyWorks
  Template:
    Content: |
    {
        "name": "{{.Resource.Name}}",
        "description": "This is a data template for {{.Resource.Name}}"
    }

Creating Template#

To crete a new template, use the template submit command:

pars template submit --file <file_path>

Listing Templates#

To list all available templates, use the template list command:

pars template list

Removing Template#

To remove a template, use the template remove command:

pars template remove <template_name>

All Template Types#