> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-gateway/5/iagctl/create-decorator/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # iagctl create decorator Create a new decorator. For detailed information on creating and using decorators, see [Validate and limit service inputs with decorators](../using-decorators). The `iagctl create decorator` command creates a decorator in your gateway data store. Decorators use JSON Schema to validate the inputs passed to a service at runtime, letting you control exactly which inputs a service accepts. ## Syntax ```bash iagctl create decorator --schema [flags] ``` ## JSON Schema overview Decorators rely on a JSON Schema document to define and validate service inputs. Each service input corresponds to a property in the schema's `properties` object. The following fields are particularly relevant in Gateway: | Field | Description | | :-------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `type` | The data type for the input. Accepts one of the following values: `string`, `number`, `integer`, `object`, `array`, `boolean`, or `null`. For Python script services, properties defined as `boolean` use bare `--set key` syntax at runtime rather than `--set key=value`. For more information, see [Boolean properties in Python script services](../using-decorators#boolean-properties-in-python-script-services). | | `enum` | A limited set of accepted values for the input. | | `x-itential-payload-type` | For Python script services, set to `file` to have Gateway write a large property value to a temporary file instead of passing it as a CLI argument. Requires `x-itential-payload-target`. For more information, see [Pass large values as files in Python script services](../using-decorators#pass-large-values-as-files-in-python-script-services). | | `x-itential-payload-target` | The name of the environment variable Gateway uses to pass the temporary file path to your script when `x-itential-payload-type` is set to `file`. | For additional validation options, see the [JSON Schema website](https://json-schema.org/draft/2020-12/json-schema-validation). For example, consider a gateway service that takes two inputs: `interface` and `device_type`. The following JSON Schema document validates those inputs: ```json { "$id": "root", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "interface": { "type": "string", "description": "The interface to update" }, "device_type": { "type": "string", "description": "The type of device", "enum": ["ios", "eos", "nxos"] } }, "required": [ "interface", "device_type" ], "additionalProperties": false } ``` When you specify this decorator on a service, it validates that the `interface` and `device_type` inputs are passed correctly in the `iagctl run service` request: ```bash iagctl run pythonscript example-service-with-deco \ --set interface=1/1/1 \ --set device_type=eos ``` ## Examples ### Create a decorator from a file To create a decorator from a JSON Schema file called `my_decorator.json`, run the following command: ```bash iagctl create decorator my-decorator \ --schema @my_decorator.json ``` You typically format schema files as JSON, but Gateway also accepts YAML. ### Create a decorator from inline JSON You can also specify the JSON Schema content directly in the command. Wrap your JSON in single quotes: ```bash iagctl create decorator my-decorator \ --schema '{"$id":"root","$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"interface":{"type":"string"}}}' ``` ## Options ```bash --description string A brief description of the decorator -h, --help Help for decorator --schema string The schema of the decorator. Accepts inline JSON or a file reference prefixed with '@'. --tag stringArray Metadata tag(s) to associate with the decorator ``` ## Options inherited from parent commands ```bash --profile string Specify the client profile to use (case-insensitive, defaults to [client] section) --config string Path to the configuration file --raw Display the result of the command in raw format --verbose Enable verbose output ```