From 95f1a8d2414f8275ced5efbb56af83b01f6ca2d7 Mon Sep 17 00:00:00 2001 From: Aditya Singh Date: Thu, 9 Apr 2026 15:01:41 +0530 Subject: [PATCH] Add SystemRelationship support on ComponentType and ComponentTypeInput Mirrors the existing OwnerRelationship implementation 1:1 to expose the public GraphQL `systemRelationship` field on ComponentType and the corresponding argument on ComponentTypeInput. --- .../unreleased/Feature-20260409-144550.yaml | 3 +++ input.go | 18 ++++++++++----- object.go | 22 ++++++++++++------- testdata/templates/component_type.tpl | 15 ++++++++++++- 4 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 .changes/unreleased/Feature-20260409-144550.yaml diff --git a/.changes/unreleased/Feature-20260409-144550.yaml b/.changes/unreleased/Feature-20260409-144550.yaml new file mode 100644 index 00000000..9a26b4a3 --- /dev/null +++ b/.changes/unreleased/Feature-20260409-144550.yaml @@ -0,0 +1,3 @@ +kind: Feature +body: Add SystemRelationship support on ComponentType and ComponentTypeInput +time: 2026-04-09T14:45:50.438117+05:30 diff --git a/input.go b/input.go index 2170c22e..bff7ca4f 100644 --- a/input.go +++ b/input.go @@ -700,12 +700,13 @@ type ComponentTypeIconInput struct { // ComponentTypeInput Specifies the input fields used to create a component type type ComponentTypeInput struct { - Alias *Nullable[string] `json:"alias,omitempty" yaml:"alias,omitempty" example:"example_value"` // The unique alias of the component type (Optional) - Description *Nullable[string] `json:"description,omitempty" yaml:"description,omitempty" example:"example_value"` // The description of the component type (Optional) - Icon *ComponentTypeIconInput `json:"icon,omitempty" yaml:"icon,omitempty"` // The icon associated with the component type (Optional) - Name *Nullable[string] `json:"name,omitempty" yaml:"name,omitempty" example:"example_value"` // The unique name of the component type (Optional) - OwnerRelationship *OwnerRelationshipInput `json:"ownerRelationship,omitempty" yaml:"ownerRelationship,omitempty"` // The owner relationship for the component type (Optional) - Properties *[]ComponentTypePropertyDefinitionInput `json:"properties,omitempty" yaml:"properties,omitempty" example:"[]"` // A list of property definitions for the component type (Optional) + Alias *Nullable[string] `json:"alias,omitempty" yaml:"alias,omitempty" example:"example_value"` // The unique alias of the component type (Optional) + Description *Nullable[string] `json:"description,omitempty" yaml:"description,omitempty" example:"example_value"` // The description of the component type (Optional) + Icon *ComponentTypeIconInput `json:"icon,omitempty" yaml:"icon,omitempty"` // The icon associated with the component type (Optional) + Name *Nullable[string] `json:"name,omitempty" yaml:"name,omitempty" example:"example_value"` // The unique name of the component type (Optional) + OwnerRelationship *OwnerRelationshipInput `json:"ownerRelationship,omitempty" yaml:"ownerRelationship,omitempty"` // The owner relationship for the component type (Optional) + SystemRelationship *SystemRelationshipInput `json:"systemRelationship,omitempty" yaml:"systemRelationship,omitempty"` // The system relationship for the component type (Optional) + Properties *[]ComponentTypePropertyDefinitionInput `json:"properties,omitempty" yaml:"properties,omitempty" example:"[]"` // A list of property definitions for the component type (Optional) } // ComponentTypePropertyDefinitionInput The input for defining a property @@ -998,6 +999,11 @@ type OwnerRelationshipInput struct { ManagementRules *[]ManagementRuleInput `json:"managementRules,omitempty" yaml:"managementRules,omitempty"` // The management rules for the relationship (Optional) } +// SystemRelationshipInput The input for defining the system relationship for a component type +type SystemRelationshipInput struct { + ManagementRules *[]ManagementRuleInput `json:"managementRules,omitempty" yaml:"managementRules,omitempty"` // The management rules for the relationship (Optional) +} + // PayloadFilterInput Input to be used to filter types type PayloadFilterInput struct { Arg *Nullable[string] `json:"arg,omitempty" yaml:"arg,omitempty" example:"example_value"` // Value to be filtered (Optional) diff --git a/object.go b/object.go index 4ce3dcb3..1f829124 100644 --- a/object.go +++ b/object.go @@ -145,14 +145,15 @@ type ComponentTypeId struct { // ComponentType Information about a particular component type type ComponentType struct { ComponentTypeId - Description string // The description of the component type (Optional) - Href string // The relative path to link to the component type (Required) - Icon ComponentTypeIcon // The icon associated with the component type (Required) - IsDefault bool // Whether or not the component type is the default (Required) - Name string // The name of the component type (Required) - OwnerRelationship OwnerRelationshipType // The owner relationship for this component type (Required) - Timestamps Timestamps // When the component type was created and updated (Required) - Properties *PropertyDefinitionConnection `graphql:"-"` + Description string // The description of the component type (Optional) + Href string // The relative path to link to the component type (Required) + Icon ComponentTypeIcon // The icon associated with the component type (Required) + IsDefault bool // Whether or not the component type is the default (Required) + Name string // The name of the component type (Required) + OwnerRelationship OwnerRelationshipType // The owner relationship for this component type (Required) + SystemRelationship SystemRelationshipType // The system relationship for this component type (Required) + Timestamps Timestamps // When the component type was created and updated (Required) + Properties *PropertyDefinitionConnection `graphql:"-"` } // ComponentTypeIcon The icon for a component type @@ -397,6 +398,11 @@ type OwnerRelationshipType struct { ManagementRules []RelationshipDefinitionManagementRule // The management rules for the owner relationship (Required) } +// SystemRelationshipType The system relationship for a component type +type SystemRelationshipType struct { + ManagementRules []RelationshipDefinitionManagementRule // The management rules for the system relationship (Required) +} + // Predicate A condition used to select services type Predicate struct { Type PredicateTypeEnum // Type of operation to be used in the condition (Required) diff --git a/testdata/templates/component_type.tpl b/testdata/templates/component_type.tpl index f1634019..445cbefb 100644 --- a/testdata/templates/component_type.tpl +++ b/testdata/templates/component_type.tpl @@ -1,5 +1,5 @@ {{- define "component_type_graphql" }} -{id,aliases,description,href,icon{color,name},isDefault,name,ownerRelationship{managementRules{operator,sourceProperty,sourcePropertyBuiltin,targetCategory,targetProperty,targetPropertyBuiltin,targetType}},timestamps{createdAt,updatedAt}} +{id,aliases,description,href,icon{color,name},isDefault,name,ownerRelationship{managementRules{operator,sourceProperty,sourcePropertyBuiltin,targetCategory,targetProperty,targetPropertyBuiltin,targetType}},systemRelationship{managementRules{operator,sourceProperty,sourcePropertyBuiltin,targetCategory,targetProperty,targetPropertyBuiltin,targetType}},timestamps{createdAt,updatedAt}} {{end}} {{- define "component_type_1_response" }} { @@ -26,6 +26,19 @@ "targetType": "team" } ] + }, + "systemRelationship": { + "managementRules": [ + { + "operator": "EQUALS", + "sourceProperty": "tag_key_eq:system", + "sourcePropertyBuiltin": true, + "targetCategory": null, + "targetProperty": "name", + "targetPropertyBuiltin": true, + "targetType": "system" + } + ] } } {{end}}