Configuring validation for text inputs and outputs in automations
You can validate text type inputs and outputs by configuring a JSON schema and then uploading a .yaml file. The JSON schema easily transfers the data to the REST service from the automation rule. The .yaml file generates the Swagger documentation with the sample JSON request and response.
- Create a new automation or open an existing automation.
Choices Actions Create a new automation Follow the steps in Creating an automation. Open an existing automation - In the navigation pane of Dev Studio, click Records.
- Expand the Technical category and click Activity.
- Locate the automation for which you want to simulate a JSON
response and click in its row.Automations have the activity type AUTOMATION.
- On the Definition tab, in the Inputs section, locate a text input value, and then click the gear icon.
- In the Validation section, choose one of the following
options:
- To accept any text value input, select None.
- To specify a set of values that you want to allow for the input parameter, select Input values.
- To configure a JSON object input by providing a
.yaml
text file, select JSON schema.Note: Make sure that you provide a text file with valid OpenAPI specific .yaml
content. Pega Platform uses the OpenAPI specific.yaml
content to generate the Swagger documentation with the sample JSON request and response. If the.yaml
content is invalid, the system displays an error and you cannot submit the file.For more information about which tags Pega Platform supports, refer to the Supported JSON Schema Keywords section of your Swagger developer documentation.
- Configure the input values according to your validation choice.
Choices Actions None - In the Default value field, enter a
default value to use if the system cannot find a value for
the input.
Note: The Default value field is displayed if the Required check box in the Inputs section is cleared. - Click Submit.
Input values - In the Values section, click Add value, and then enter a value for the input parameter.
- Repeat step a to add additional values to the set of values that you want to allow for the input parameter.
- In the Default value field, select
the default value that the system can accept as an
input.
Note: The Default value field is displayed if the Required check box in the Inputs section is cleared. - Click Submit.
JSON schema - Provide a
.yaml
file by using one of the following methods:- In the Text file (.yaml)
field, press the Down arrow key to select a
.yaml
file from the list of text files. - Enter a name in the Text file
(.yaml) field and click the rule
opener to create a
.yaml
text file.For more information, see Viewing test coverage reports.
- In the Text file (.yaml)
field, press the Down arrow key to select a
- Click Submit.
- In the Default value field, enter a
default value to use if the system cannot find a value for
the input.
- In the Outputs section, locate the text output value that you want to configure, and then click the gear icon.
- In the Validation section, choose one of the following
options:
- To accept any text value output, select None, and then click Submit.
- To specify a set of values that you want to allow for the output parameter, select Output values. Complete the Values section as described in step 4.
- To configure a JSON object output by providing a
.yaml
text file, select JSON schema, and then add a.yaml
file as described in step 4.
- Click Save.
Previous topic Configuring outputs for an automation Next topic Configuring errors for an automation