Skip to content

Commit a640bef

Browse files
Add support for owner relationships & component category predicates (#597)
* input type seems correct * run client gen? * schema seems pretty correct * add component category * update tests * add changie
1 parent 62939a7 commit a640bef

8 files changed

Lines changed: 108 additions & 84 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 support for owner relationships & component category predicates
3+
time: 2025-12-11T14:52:11.411595-05:00

component_test.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,23 @@ func TestComponentTypeCreate(t *testing.T) {
1515
Name: ol.RefOf("Example"),
1616
Description: ol.RefOf("Example Description"),
1717
Properties: &[]ol.ComponentTypePropertyDefinitionInput{},
18+
OwnerRelationship: &ol.OwnerRelationshipInput{
19+
ManagementRules: &[]ol.ManagementRuleInput{
20+
{
21+
Operator: ol.RelationshipDefinitionManagementRuleOperatorEquals,
22+
SourceProperty: "tag_key_eq:owner",
23+
SourcePropertyBuiltin: true,
24+
TargetProperty: "name",
25+
TargetPropertyBuiltin: true,
26+
TargetType: ol.NewNullableFrom("team"),
27+
},
28+
},
29+
},
1830
})
1931

2032
testRequest := autopilot.NewTestRequest(
2133
`mutation ComponentTypeCreate($input:ComponentTypeInput!){componentTypeCreate(input:$input){componentType{{ template "component_type_graphql" }},errors{message,path}}}`,
22-
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": []} }`,
34+
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": [], "ownerRelationship": {"managementRules": [{"operator": "EQUALS", "sourceProperty": "tag_key_eq:owner", "sourcePropertyBuiltin": true, "targetProperty": "name", "targetPropertyBuiltin": true, "targetType": "team"}]} }}`,
2335
`{"data": {"componentTypeCreate": {"componentType": {{ template "component_type_1_response" }} }}}`,
2436
)
2537

@@ -81,11 +93,23 @@ func TestComponentTypeUpdate(t *testing.T) {
8193
Name: ol.RefOf("Example"),
8294
Description: ol.RefOf("Example Description"),
8395
Properties: &[]ol.ComponentTypePropertyDefinitionInput{},
96+
OwnerRelationship: &ol.OwnerRelationshipInput{
97+
ManagementRules: &[]ol.ManagementRuleInput{
98+
{
99+
Operator: ol.RelationshipDefinitionManagementRuleOperatorEquals,
100+
SourceProperty: "tag_key_eq:owner",
101+
SourcePropertyBuiltin: true,
102+
TargetProperty: "name",
103+
TargetPropertyBuiltin: true,
104+
TargetType: ol.NewNullableFrom("team"),
105+
},
106+
},
107+
},
84108
})
85109

86110
testRequest := autopilot.NewTestRequest(
87111
`mutation ComponentTypeUpdate($input:ComponentTypeInput!$target:IdentifierInput!){componentTypeUpdate(componentType:$target,input:$input){componentType{{ template "component_type_graphql" }},errors{message,path}}}`,
88-
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": []}, "target": { {{ template "id1" }} }}`,
112+
`{"input": {"alias": "example", "name": "Example", "description": "Example Description", "properties": [], "ownerRelationship": {"managementRules": [{"operator": "EQUALS", "sourceProperty": "tag_key_eq:owner", "sourcePropertyBuiltin": true, "targetProperty": "name", "targetPropertyBuiltin": true, "targetType": "team"}]}}, "target": { {{ template "id1" }} }}`,
89113
`{"data": {"componentTypeUpdate": {"componentType": {{ template "component_type_1_response" }} }}}`,
90114
)
91115

enum.go

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,30 +2859,32 @@ var AllPayloadSortEnum = []string{
28592859
type PredicateKeyEnum string
28602860

28612861
var (
2862-
PredicateKeyEnumAliases PredicateKeyEnum = "aliases" // Filter by Alias attached to this service, if any
2863-
PredicateKeyEnumComponentTypeID PredicateKeyEnum = "component_type_id" // Filter by the `component_type` field
2864-
PredicateKeyEnumCreationSource PredicateKeyEnum = "creation_source" // Filter by the creation source
2865-
PredicateKeyEnumDomainID PredicateKeyEnum = "domain_id" // Filter by Domain that includes the System this service is assigned to, if any
2866-
PredicateKeyEnumFilterID PredicateKeyEnum = "filter_id" // Filter by another filter
2867-
PredicateKeyEnumFramework PredicateKeyEnum = "framework" // Filter by `framework` field
2868-
PredicateKeyEnumGroupIDs PredicateKeyEnum = "group_ids" // Filter by group hierarchy. Will return resources who's owner is in the group ancestry chain
2869-
PredicateKeyEnumLanguage PredicateKeyEnum = "language" // Filter by `language` field
2870-
PredicateKeyEnumLifecycleIndex PredicateKeyEnum = "lifecycle_index" // Filter by `lifecycle` field
2871-
PredicateKeyEnumName PredicateKeyEnum = "name" // Filter by `name` field
2872-
PredicateKeyEnumOwnerID PredicateKeyEnum = "owner_id" // Filter by `owner` field
2873-
PredicateKeyEnumOwnerIDs PredicateKeyEnum = "owner_ids" // Filter by `owner` hierarchy. Will return resources who's owner is in the team ancestry chain
2874-
PredicateKeyEnumProduct PredicateKeyEnum = "product" // Filter by `product` field
2875-
PredicateKeyEnumProperties PredicateKeyEnum = "properties" // Filter by custom-defined properties
2876-
PredicateKeyEnumRelationships PredicateKeyEnum = "relationships" // Filter by `relationships`
2877-
PredicateKeyEnumRepositoryIDs PredicateKeyEnum = "repository_ids" // Filter by Repository that this service is attached to, if any
2878-
PredicateKeyEnumSystemID PredicateKeyEnum = "system_id" // Filter by System that this service is assigned to, if any
2879-
PredicateKeyEnumTags PredicateKeyEnum = "tags" // Filter by `tags` field
2880-
PredicateKeyEnumTierIndex PredicateKeyEnum = "tier_index" // Filter by `tier` field
2862+
PredicateKeyEnumAliases PredicateKeyEnum = "aliases" // Filter by Alias attached to this service, if any
2863+
PredicateKeyEnumComponentCategory PredicateKeyEnum = "component_category" // Filter by the component type category for this service
2864+
PredicateKeyEnumComponentTypeID PredicateKeyEnum = "component_type_id" // Filter by the `component_type` field
2865+
PredicateKeyEnumCreationSource PredicateKeyEnum = "creation_source" // Filter by the creation source
2866+
PredicateKeyEnumDomainID PredicateKeyEnum = "domain_id" // Filter by Domain that includes the System this service is assigned to, if any
2867+
PredicateKeyEnumFilterID PredicateKeyEnum = "filter_id" // Filter by another filter
2868+
PredicateKeyEnumFramework PredicateKeyEnum = "framework" // Filter by `framework` field
2869+
PredicateKeyEnumGroupIDs PredicateKeyEnum = "group_ids" // Filter by group hierarchy. Will return resources who's owner is in the group ancestry chain
2870+
PredicateKeyEnumLanguage PredicateKeyEnum = "language" // Filter by `language` field
2871+
PredicateKeyEnumLifecycleIndex PredicateKeyEnum = "lifecycle_index" // Filter by `lifecycle` field
2872+
PredicateKeyEnumName PredicateKeyEnum = "name" // Filter by `name` field
2873+
PredicateKeyEnumOwnerID PredicateKeyEnum = "owner_id" // Filter by `owner` field
2874+
PredicateKeyEnumOwnerIDs PredicateKeyEnum = "owner_ids" // Filter by `owner` hierarchy. Will return resources who's owner is in the team ancestry chain
2875+
PredicateKeyEnumProduct PredicateKeyEnum = "product" // Filter by `product` field
2876+
PredicateKeyEnumProperties PredicateKeyEnum = "properties" // Filter by custom-defined properties
2877+
PredicateKeyEnumRelationships PredicateKeyEnum = "relationships" // Filter by `relationships`
2878+
PredicateKeyEnumRepositoryIDs PredicateKeyEnum = "repository_ids" // Filter by Repository that this service is attached to, if any
2879+
PredicateKeyEnumSystemID PredicateKeyEnum = "system_id" // Filter by System that this service is assigned to, if any
2880+
PredicateKeyEnumTags PredicateKeyEnum = "tags" // Filter by `tags` field
2881+
PredicateKeyEnumTierIndex PredicateKeyEnum = "tier_index" // Filter by `tier` field
28812882
)
28822883

28832884
// All PredicateKeyEnum as []string
28842885
var AllPredicateKeyEnum = []string{
28852886
string(PredicateKeyEnumAliases),
2887+
string(PredicateKeyEnumComponentCategory),
28862888
string(PredicateKeyEnumComponentTypeID),
28872889
string(PredicateKeyEnumCreationSource),
28882890
string(PredicateKeyEnumDomainID),
@@ -3469,18 +3471,6 @@ var AllTypeEnum = []string{
34693471
string(TypeEnumStartsWith),
34703472
}
34713473

3472-
type RelationshipOperatorEnum string
3473-
3474-
var (
3475-
RelationshipOperatorEnumEquals RelationshipOperatorEnum = "EQUALS" // Matches a specific value
3476-
RelationshipOperatorEnumArrayContains RelationshipOperatorEnum = "ARRAY_CONTAINS" // Matches any value within an array
3477-
)
3478-
3479-
var AllRelationshipOperatorEnum = []string{
3480-
string(RelationshipOperatorEnumEquals),
3481-
string(RelationshipOperatorEnumArrayContains),
3482-
}
3483-
34843474
// UserRole A role that can be assigned to a user
34853475
type UserRole string
34863476

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
require (
2424
dario.cat/mergo v1.0.1 // indirect
2525
github.com/Masterminds/goutils v1.1.1 // indirect
26-
github.com/Masterminds/semver/v3 v3.3.0 // indirect
26+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2727
github.com/coder/websocket v1.8.13 // indirect
2828
github.com/davecgh/go-spew v1.1.1 // indirect
2929
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
@@ -44,4 +44,5 @@ require (
4444
golang.org/x/net v0.43.0 // indirect
4545
golang.org/x/sys v0.35.0 // indirect
4646
golang.org/x/text v0.28.0 // indirect
47+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
4748
)

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
22
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
33
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
44
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
5-
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
6-
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
5+
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
6+
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
77
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
88
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
99
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
@@ -91,7 +91,8 @@ golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
9191
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
9292
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
9393
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
94-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
9594
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
95+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
96+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9697
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
9798
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)