> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

Array

Array is a data type used to save lists of data.

Common usage​

Use array properties to store multiple values for an entity, such as:

  • Programming languages used in a repository.
  • Container image tags available for a service.
  • Monitoring tools configured for a service.
  • Links to runbooks and dashboards.

Use relations when these values represent other entities in your catalog.

Multi source ingestion​

By default, array properties use last-writer-wins behavior: each update replaces the full array.

Enable Multi source ingestion to let multiple data sources or API callers contribute to the same list without overwriting each other. This works for string and number item types only.

In the Data model or software catalog, turn on Multi source ingestion when creating the property.

In the API, set "union": true. This setting cannot be changed after creation.

Example​

The service blueprint has multi source ingestion enabled on its vulnerabilities property. For a payments-api entity:

  1. Monday - the Snyk integration writes { "snyk": ["CVE-101", "CVE-102"] }.
  2. Tuesday - Dependabot writes { "dependabot": ["CVE-102", "CVE-203"] } without removing Snyk's findings.
  3. Wednesday - Alice edits the entity in the UI and adds CVE-300. Port saves her changes under user:alice.

A GET returns the merged, deduplicated array:

{ "vulnerabilities": ["CVE-101", "CVE-102", "CVE-203", "CVE-300"] }

Each writer only updates its own source key. CVE-102 appears once even though both scanners reported it.

Write and read values​

Write (POST, PATCH, PUT) - send one source key per update:

{
"properties": {
"vulnerabilities": {
"scanner-a": ["CVE-2024-1", "CVE-2024-2"]
}
}
}

Use null instead of an array to clear a source's slice.

Source keys must match ^[A-Za-z0-9._:@/-]{1,128}$.

Read (GET, search) - Port returns the merged, deduplicated array:

{ "vulnerabilities": ["CVE-2024-1", "CVE-2024-2", "CVE-2024-3"] }

In the UI, you edit the assembled array directly. Port stores UI edits under user:{userId} automatically.

Related property types

Calculation and aggregation properties read the assembled value.

Multi source ingestion works the same way for relations and owning teams: each writer owns a source key, and reads return the deduplicated combination of all sources.

Constraints​

  • items.type must be string or number.
  • minItems and maxItems are not supported with union.
  • You cannot toggle union after creation. Create a new property and migrate the data instead.
  • Sending a plain array, multiple source keys, or an invalid source key returns 422.

API definition​

{
"myArrayProp": {
"title": "My array",
"icon": "My icon",
"description": "My array property",
"type": "array",
"default": [1, 2, 3]
}
}

Check out Port's API reference to learn more.

Terraform definition​

The examples below use version 2.29.0 of the Terraform and Pulumi providers. Configure your provider first, then run one example at a time in its own project. Each example creates a blueprint; use distinct identifiers when you combine examples.

resource "port_blueprint" "myBlueprint" {
identifier = "myBlueprint"
title = "My blueprint"
properties = {
array_props = {
"myArrayProp" = {
title = "My array"
required = true
string_items = {}
}
}
}
}
Array types in Terraform

To set the type of an array property, you need to use the <type>_items property type. For example, to set an array of strings, you need to use the string_items property type.

resource "port_blueprint" "myBlueprint" {
identifier = "myBlueprint"
title = "My blueprint"
properties = {
array_props = {
"myArrayProp" = {
title = "My array"
required = true
string_items = {} # You can also set here default values
}
}
}
}

We currently support the following types of array items: string_items, number_items, boolean_items, object_items.

Pulumi definition​

"""A Python Pulumi program"""

import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertiesArrayPropsArgs

blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
array_props={
"myArrayProp": BlueprintPropertiesArrayPropsArgs(
title="My array", required=True, string_items={},
)
}
),
relations={}
)

Validate array​

Array validations support the following operators:

  • minItems
  • maxItems
  • uniqueItems

minItems and maxItems are not supported on array properties with multi source ingestion enabled.

JSON schema validations

Array validations follow the JSON schema model, refer to the JSON schema docs to learn about all of the available validations

{
"myArrayProp": {
"title": "My array",
"icon": "My icon",
"description": "My array property",
"type": "array",
"minItems": 0,
"maxItems": 5,
"uniqueItems": false
}
}