Skip to main content

Number

Number is a basic input for numeric data.

💡 Common number usage​

The number input type can be used to store any numeric data, for example:

  • Memory/storage allocations
  • Replica counts
  • Number of days to retain data

In the live demo self-service hub page, we can see the scaffold new service action whose K8s Replica Count input is a number input. 🎬

API definition​

{
"myNumberInput": {
"title": "My number input",
"icon": "My icon",
"description": "My number input",
"type": "number",
"default": 7
}
}

Check out Port's API reference to learn more.

Terraform definition​

resource "port_action" "myAction" {
# ...action properties
user_properties = {
number_props = {
"myNumberInput" = {
title = "My number input"
description = "My number input"
default = 7
}
}
}
}

Validate number​

Number validations support the following operators:

  • range

Ranges of numbers are specified using a combination of the minimum and maximum keywords, (or exclusiveMinimum and exclusiveMaximum for expressing exclusive range).

If x is the value being validated, the following must hold true:

  • x ≥ minimum
  • x > exclusiveMinimum
  • x ≤ maximum
  • x < exclusiveMaximum
{
"myNumberInput": {
"title": "My number input",
"icon": "My icon",
"description": "My number input",
"type": "number",
"minimum": 0,
"maximum": 50
}
}