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

Check out Port for yourself ➜ 

JSON

JSON is a data type used to save structured data as key-value pairs.

Common usage​

Use JSON properties to store structured data, such as:

  • Cloud resource tags and Kubernetes labels.
  • Service configuration values.
  • Structured metadata from an integration.

API definition​

JSON properties use "type": "object" without a format field. The following example defines the property in your blueprint; icon, description, and default are optional.

{
"myObjectProp": {
"type": "object",
"title": "My object"
}
}

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 = {
object_props = {
"myObjectProp" = {
title = "My object"
icon = "My icon"
description = "My object property"
default = jsonencode({ "myKey" = "myValue" })
}
}
}
}

Pulumi definition​

"""A Python Pulumi program"""

import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertiesObjectPropsArgs

blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
object_props={
"myObjectProp": BlueprintPropertiesObjectPropsArgs(
title="My object", required=False
)
}
),
relations={},
)

Validate object​

Object validations support the following operators:

  • properties - which keys must appear and what their type should be.
  • additionalProperties - are keys not defined in properties allowed and what their type should be.
  • patternProperties - which regex pattern should properties follow
JSON schema validations

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

{
"myObjectProp": {
"title": "My object",
"icon": "My icon",
"description": "My object property",
"type": "object",
"properties": {
"myRequiredProp": { "type": "number" }
},
"patternProperties": {
"^S_": { "type": "string" },
"^I_": { "type": "number" }
},
"additionalProperties": true
}
}