Skip to content

Commit 1c805dc

Browse files
committed
fix: undo mods to label system
1 parent 4462a56 commit 1c805dc

File tree

4 files changed

+3
-40
lines changed

4 files changed

+3
-40
lines changed

pkg/scm/gitlab/context.model.go

-21
This file was deleted.

schema/gitlab.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ func nest(props []*Property) {
6868
for _, field := range props {
6969

7070
if field.IsCustomType {
71-
fmt.Println("nesting", field.Name, "of type", field.Type)
72-
7371
for _, nested := range PropMap[field.Type].Attributes {
7472
field.AddAttribute(&Property{
7573
Name: nested.Name,
@@ -198,11 +196,9 @@ func mutateHook(b *modelgen.ModelBuild) *modelgen.ModelBuild {
198196
}
199197

200198
fieldProperty.Type = strings.TrimPrefix(fieldType, "*")
201-
fieldProperty.IsSlice = strings.HasPrefix(fieldType, "[]") || fieldType == "labels"
199+
fieldProperty.IsSlice = strings.HasPrefix(fieldType, "[]") || fieldType == "label"
202200

203201
modelProperty.AddAttribute(fieldProperty)
204-
205-
fmt.Println(" ", fieldProperty.Name, "of type", fieldProperty.Type)
206202
} // end expr tag is set
207203

208204
slices.SortFunc(modelProperty.Attributes, sortSlice)
@@ -214,13 +210,6 @@ func mutateHook(b *modelgen.ModelBuild) *modelgen.ModelBuild {
214210
continue
215211
}
216212

217-
if modelProperty.Type == "label" {
218-
modelProperty.Type = "labels"
219-
modelProperty.IsSlice = true
220-
}
221-
222-
fmt.Println("Registering custom model", modelProperty.Name, "of type", modelProperty.Type)
223-
224213
Props = append(Props, modelProperty)
225214
PropMap[modelProperty.Type] = modelProperty
226215
} // end model loop

schema/gitlab.gqlgen.yml

-3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,3 @@ models:
8888
Duration:
8989
model:
9090
- github.com/99designs/gqlgen/graphql.Duration
91-
ContextLabels:
92-
model:
93-
- ../pkg/scm/gitlab.ContextLabels

schema/gitlab.schema.graphqls

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ scalar Time
2121
# Add time.Duration support
2222
scalar Duration
2323

24-
scalar ContextLabels
25-
2624
type Context {
2725
"The project the Merge Request belongs to"
2826
Project: ContextProject @graphql(key: "project(fullPath: $project_id)")
@@ -68,7 +66,7 @@ type ContextProject {
6866
# Connections
6967
#
7068

71-
Labels: ContextLabels @generated
69+
Labels: [ContextLabel!] @generated
7270
ResponseLabels: ContextLabelNode @internal @graphql(key: "labels(first: 200)")
7371
MergeRequest: ContextMergeRequest @internal @graphql(key: "mergeRequest(iid: $mr_id)")
7472
ResponseGroup: ContextGroup @internal @graphql(key: "group")
@@ -180,7 +178,7 @@ type ContextMergeRequest {
180178
#
181179

182180
DiffStats: [ContextDiffStat!]
183-
Labels: ContextLabels @generated
181+
Labels: [ContextLabel!] @generated
184182
ResponseLabels: ContextLabelNode @internal @graphql(key: "labels(first: 200)")
185183
ResponseFirstCommits: ContextCommitsNode @internal @graphql(key: "first_commit: commits(first:1)")
186184
ResponseLastCommits: ContextCommitsNode @internal @graphql(key: "last_commit: commits(last:1)")

0 commit comments

Comments
 (0)