LinkedIn
Copied!

Table of Contents

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.

A Text value displayed in the Data type column of the automation rule form indicates a text input.

  1. 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
    1. In the navigation pane of Dev Studio, click Records.

    2. Expand the Technical category and click Activity.

    3. Locate the automation for which you want to simulate a JSON response and click in its row.

      Automations have the activity type AUTOMATION.
  2. On the Definition tab, in the Inputs section, locate a text input value, and then click the gear icon.

  3. 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.
      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.

  4. Configure the input values according to your validation choice.

    Choices Actions
    None
    1. In the Default value field, enter a default value to use if the system cannot find a value for the input.

      The Default value field is displayed if the Required check box in the Inputs section is cleared.
    2. Click Submit.

    Input values
    1. In the Values section, click Add value, and then enter a value for the input parameter.

    2. Repeat step a to add additional values to the set of values that you want to allow for the input parameter.

    3. In the Default value field, select the default value that the system can accept as an input.

      The Default value field is displayed if the Required check box in the Inputs section is cleared.
    4. Click Submit.

    JSON schema
    1. 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 Text File rules.

    2. Click Submit.

  5. In the Outputs section, locate the text output value that you want to configure, and then click the gear icon.

  6. 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.
  7. Click Save.

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.