Input schemas

When an HTTP Request flow receives a JSON payload, such as a POST or PUT request, it's important that the flow validates the payload. This ensures the data is in the expected shape and format.

One way to validate incoming payloads is with an input schema.

An input schema defines the shape of an object, including the properties it contains and the allowed values of those properties. They're comparable to a JSON Schema, except that they're created via FL0's UI.

The main advantage of input schemas, aside from being easier to create and configure than a JSON Schema, is that they're defined in a central location, which makes it possible to reuse them throughout a project.

Creating an input schema

  1. Open a project.
  2. In the Explorer pane, click Create new.
  3. Select Input schema.
  4. Enter a name for the schema.
  5. Tap the Return key.

Adding properties to an input schemas

Adding properties to an input schema is similar to adding fields to a database table.

To add a property to an input schema, follow these steps:

  1. Enter a name into the Name field.
  2. Select a data type from the Data type field.
  3. Configure the available fields. (The available fields depend on the Data type.)
  4. Click Save.

Supported data types

When adding a property to an input schema, the following data types are supported:

  • Array
  • Boolean
  • DateTime
  • Decimal
  • Guid
  • Integer
  • Object
  • String

Using an input schema

You can use input schemas in many of the same places that JSON objects are accepted.

To see an example of how to use an input schema, follow these steps:

  1. Create an HTTP Request flow.
  2. Set the Start component's Method to POST.
  3. Select Input Type > Input Schema.
  4. Select an input schema from the Input Schema dropdown.

Based on this change, request bodies that don't validate against the input schema are rejected.