Skip to main content

✅ Configuration Validation

The Ocean framework provides a convenient way to validate the configuration of an integration.

By providing a validation specification (provided in the spec.yml file), the Ocean framework can verify that the configuration provided to the integration contains all required parameters in the expected format, ensuring it can start and perform its logic.

Ocean performs configuration validation based on the specification provided in the .port/spec.yml file.

How to setup configuration type validation

To setup configuration type validation, the integration needs to provide the available inputs and their types using the .port/spec.yaml file.

Supported parameter configuration types

The Ocean framework supports the following configuration types:

  • string - Will check if the value is a valid string. For example: my string
  • integer - Will check if the value is a valid integer. For example: 123
  • boolean - Will check if the value is a valid boolean. For example: true
  • object - Will check if the value is a valid JSON object. For example: {"key": "value"}
  • url - Will check if the value is a valid URL. For example: https://www.google.com

Example

.port/spec.yml
configurations:
- name: myBooleanParameter
type: boolean
description: My boolean parameter
❌ Invalid configuration
config.yml
...
integration:
...
config:
myBooleanParameter: 123 # This will fail validation
✅ Valid configuration
config.yml
...
integration:
...
config:
myBooleanParameter: true # This is a valid configuration