Skip to content

Commit 399bfc8

Browse files
saditya370Aditya Singh
andauthored
Add SystemRelationship support on ComponentType and ComponentTypeInput (#610)
Mirrors the existing OwnerRelationship implementation 1:1 to expose the public GraphQL `systemRelationship` field on ComponentType and the corresponding argument on ComponentTypeInput. Co-authored-by: Aditya Singh <aditya@opslevel.com>
1 parent 3c76911 commit 399bfc8

4 files changed

Lines changed: 43 additions & 15 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Feature
2+
body: Add SystemRelationship support on ComponentType and ComponentTypeInput
3+
time: 2026-04-09T14:45:50.438117+05:30

input.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -700,12 +700,13 @@ type ComponentTypeIconInput struct {
700700

701701
// ComponentTypeInput Specifies the input fields used to create a component type
702702
type ComponentTypeInput struct {
703-
Alias *Nullable[string] `json:"alias,omitempty" yaml:"alias,omitempty" example:"example_value"` // The unique alias of the component type (Optional)
704-
Description *Nullable[string] `json:"description,omitempty" yaml:"description,omitempty" example:"example_value"` // The description of the component type (Optional)
705-
Icon *ComponentTypeIconInput `json:"icon,omitempty" yaml:"icon,omitempty"` // The icon associated with the component type (Optional)
706-
Name *Nullable[string] `json:"name,omitempty" yaml:"name,omitempty" example:"example_value"` // The unique name of the component type (Optional)
707-
OwnerRelationship *OwnerRelationshipInput `json:"ownerRelationship,omitempty" yaml:"ownerRelationship,omitempty"` // The owner relationship for the component type (Optional)
708-
Properties *[]ComponentTypePropertyDefinitionInput `json:"properties,omitempty" yaml:"properties,omitempty" example:"[]"` // A list of property definitions for the component type (Optional)
703+
Alias *Nullable[string] `json:"alias,omitempty" yaml:"alias,omitempty" example:"example_value"` // The unique alias of the component type (Optional)
704+
Description *Nullable[string] `json:"description,omitempty" yaml:"description,omitempty" example:"example_value"` // The description of the component type (Optional)
705+
Icon *ComponentTypeIconInput `json:"icon,omitempty" yaml:"icon,omitempty"` // The icon associated with the component type (Optional)
706+
Name *Nullable[string] `json:"name,omitempty" yaml:"name,omitempty" example:"example_value"` // The unique name of the component type (Optional)
707+
OwnerRelationship *OwnerRelationshipInput `json:"ownerRelationship,omitempty" yaml:"ownerRelationship,omitempty"` // The owner relationship for the component type (Optional)
708+
SystemRelationship *SystemRelationshipInput `json:"systemRelationship,omitempty" yaml:"systemRelationship,omitempty"` // The system relationship for the component type (Optional)
709+
Properties *[]ComponentTypePropertyDefinitionInput `json:"properties,omitempty" yaml:"properties,omitempty" example:"[]"` // A list of property definitions for the component type (Optional)
709710
}
710711

711712
// ComponentTypePropertyDefinitionInput The input for defining a property
@@ -998,6 +999,11 @@ type OwnerRelationshipInput struct {
998999
ManagementRules *[]ManagementRuleInput `json:"managementRules,omitempty" yaml:"managementRules,omitempty"` // The management rules for the relationship (Optional)
9991000
}
10001001

1002+
// SystemRelationshipInput The input for defining the system relationship for a component type
1003+
type SystemRelationshipInput struct {
1004+
ManagementRules *[]ManagementRuleInput `json:"managementRules,omitempty" yaml:"managementRules,omitempty"` // The management rules for the relationship (Optional)
1005+
}
1006+
10011007
// PayloadFilterInput Input to be used to filter types
10021008
type PayloadFilterInput struct {
10031009
Arg *Nullable[string] `json:"arg,omitempty" yaml:"arg,omitempty" example:"example_value"` // Value to be filtered (Optional)

object.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,15 @@ type ComponentTypeId struct {
145145
// ComponentType Information about a particular component type
146146
type ComponentType struct {
147147
ComponentTypeId
148-
Description string // The description of the component type (Optional)
149-
Href string // The relative path to link to the component type (Required)
150-
Icon ComponentTypeIcon // The icon associated with the component type (Required)
151-
IsDefault bool // Whether or not the component type is the default (Required)
152-
Name string // The name of the component type (Required)
153-
OwnerRelationship OwnerRelationshipType // The owner relationship for this component type (Required)
154-
Timestamps Timestamps // When the component type was created and updated (Required)
155-
Properties *PropertyDefinitionConnection `graphql:"-"`
148+
Description string // The description of the component type (Optional)
149+
Href string // The relative path to link to the component type (Required)
150+
Icon ComponentTypeIcon // The icon associated with the component type (Required)
151+
IsDefault bool // Whether or not the component type is the default (Required)
152+
Name string // The name of the component type (Required)
153+
OwnerRelationship OwnerRelationshipType // The owner relationship for this component type (Required)
154+
SystemRelationship SystemRelationshipType // The system relationship for this component type (Required)
155+
Timestamps Timestamps // When the component type was created and updated (Required)
156+
Properties *PropertyDefinitionConnection `graphql:"-"`
156157
}
157158

158159
// ComponentTypeIcon The icon for a component type
@@ -397,6 +398,11 @@ type OwnerRelationshipType struct {
397398
ManagementRules []RelationshipDefinitionManagementRule // The management rules for the owner relationship (Required)
398399
}
399400

401+
// SystemRelationshipType The system relationship for a component type
402+
type SystemRelationshipType struct {
403+
ManagementRules []RelationshipDefinitionManagementRule // The management rules for the system relationship (Required)
404+
}
405+
400406
// Predicate A condition used to select services
401407
type Predicate struct {
402408
Type PredicateTypeEnum // Type of operation to be used in the condition (Required)

testdata/templates/component_type.tpl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- define "component_type_graphql" }}
2-
{id,aliases,description,href,icon{color,name},isDefault,name,ownerRelationship{managementRules{operator,sourceProperty,sourcePropertyBuiltin,targetCategory,targetProperty,targetPropertyBuiltin,targetType}},timestamps{createdAt,updatedAt}}
2+
{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}}
33
{{end}}
44
{{- define "component_type_1_response" }}
55
{
@@ -26,6 +26,19 @@
2626
"targetType": "team"
2727
}
2828
]
29+
},
30+
"systemRelationship": {
31+
"managementRules": [
32+
{
33+
"operator": "EQUALS",
34+
"sourceProperty": "tag_key_eq:system",
35+
"sourcePropertyBuiltin": true,
36+
"targetCategory": null,
37+
"targetProperty": "name",
38+
"targetPropertyBuiltin": true,
39+
"targetType": "system"
40+
}
41+
]
2942
}
3043
}
3144
{{end}}

0 commit comments

Comments
 (0)