Assigning Service Properties

After setting up Property Definitions, you can now populate your services with additional metadata. Service data can be added through the UI by visiting the Service Overview card:

Location of Custom Properties when viewing a service

To change the value, simply click on the field value and the correct form input should appear. In this particular case the user must select a single value from a list of options (the enum example above)

Edit mode of a "Dropdown" style of custom property.

Once completed, the updated value will appear in the card

Updated property value

Validation

Input is always validated against the property schema when modifying data in the UI. This ensures values entered by users conform to your definitions and produce highly accurate data. The GraphQL mutation for propertyAssign supports an optional argument of runValidation. By setting this argument to false, the mutation will always save the value, bypassing validation. This is helpful when setting up automation where if your definition changes, data will continue to persist, but warn you of any issues. Validations errors can be seen in both the API response and in the UI:

API

mutation source{
  propertyAssign(input: {
    owner: { alias: "carts"},
    definition: { alias: "type"},
    value: "\"Other\"",
    runValidation: false
  }){
    property {
      value
      owner {
        __typename
        ...on Service {
          name
        }
      }
      validationErrors {
        path
        message
      }
    }
    errors {
      path
      message
    }
  }
}
{
  "data": {
    "propertyAssign": {
      "property": {
        "value": "\"Other\"",
        "owner": {
          "__typename": "Service",
          "name": "carts"
        },
        "validationErrors": [
          {
            "path": [
              "value"
            ],
            "message": "Value doesn't satisfy the schema: root value 'Other' is not one of: Monolith, Microservice, Lambda, Gateway"
          }
        ]
      },
      "errors": []
    }
  }
}

UI

Showing property with invalid data assigned.

opslevel.yml Support

Custom Service Properties can also be managed using config-as-code with an opslevel.yml using the properties key. Only Property Definitions that allow values to be set using opslevel.yml will be processed. Properties can be referenced in the opslevel.yml file using the pre-computed alias:

---
version: 1
service:
  name: cart
  properties:
    type: Monolith

Additional Tooling Support (optional)

Custom Service Properties can also be managed through the OpsLevel toolchain, including: opslevel-cli, GraphQL and the opslevel-go client. Please refer to the respective tool to get started managing Property Definitions through automation.