Create an OpenAPI contract

You can create an OpenAPI-compliant contract and enrich the contract fields with OpenAPI attributes.


Step 1: Set the Contract Type

Set the contract type
  1. Go to the Project page.
  2. Display the Contracts tab Contracts tab.
  3. On the contract header, click Settings and select OpenApi.

Step 2: Set OpenAPI Method-Level Attributes

Set OpenAPI method-level attributes
  1. In the project side panel, select the contract method Contract method you want to set.
  2. Click the Options on the method header and select Configure OpenApi Configure OpenApi.
  3. Set the following method-level attributes:
    • OpenAPI Type: Select the HTTP method of the request.
    • Operation ID: Type a unique identifier for the method.
    • Method Path: Type the end path of the resource URL, including the path and query parameters that you specify under the OpenAPI Parameters section below (see Step 3.4 below). The default value is the method name. Then click Save.

Step 3: Set OpenAPI Field-Level Attributes

You can enrich any new or existing input or output fields with OpenAPI attributes.

Set OpenAPI field-level attributes
  1. Open the field hierarchy of an input or output node on the flow canvas.
  2. Click the Options icon of the field that you want to enrich and select Edit Edit.
    Enrich field
  3. Click the Show more link.
    Show more
  4. Select the location of the field in the context of the HTTP request:
    • Header: If the field should be specified in the header, for example, the api-key field.
    • Path: If the field is part of the endpoint URL and is not optional, for example, custId in the getCreditcard/{custID} path. Append the field to the method path you specified in the Method Path box of the Configure API popup (see Step 2.3 above).
    • Query: If the field should be specified in the query string part of the endpoint URL. For example, the username field in the /user/login?username path. Append the field to the method path you specified in the Method Path box of the Configure API popup (see Step 2.3 above).
    • Body: If the field should be specified in the body payload of the HTTP request. For example, the field creditCard in addCreditCard.
  5. Set whether the field is Required or Nullable.
  6. In the Field Validation section, set validation rules that the field values match. Each field type has a corresponding set of validation rules.

Field Validation Rules

Field TypeValidation RuleExample
StringMin Length1
Max Length5
Pattern(?<=\.) {2,}(?=[A-Z])
Enums"available", "pending", "sold"
Int, Long, DoubleMinimum0.2
Maximum0.7
Enums0.2, 0.7, 0.9
TimestampFormatMM-DD-YYYY HH:MM:SS
DateFormatMM-DD-YYYY
Boolean-False
StructureMin Properties1
Max Properties99
CollectionMin Items1
Max Items8
Unique ItemsFalse
Binary--