iagctl create decorator
Create a new decorator.
For detailed information on creating and using decorators, see Validate and limit service inputs with 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
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 IAG:
For additional validation options, see the JSON Schema website.
For example, consider a gateway service that takes two inputs: interface and device_type. The following JSON Schema document validates those inputs:
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:
Examples
Create a decorator from a file
To create a decorator from a JSON Schema file called my_decorator.json, run the following command:
You typically format schema files as JSON, but IAG 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: