Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 32b8e6c

Browse files
committedMay 11, 2024·
docs: improve UX
1 parent e20325b commit 32b8e6c

File tree

3 files changed

+36
-15
lines changed

3 files changed

+36
-15
lines changed
 

‎schema/docs.tmpl

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{{- define "enum_attribute" -}}
2-
- `{{ .BlockName }}` ({{ if .Optional }}optional {{ end }}enum) {{ .Description }}
3-
{{- range .Enum.Values }}
4-
- `{{ .Name }}` - {{ .Description }}
5-
{{- end -}}
6-
{{- end -}}
2+
- `#!css {{ .BlockName }}` ({{ if .Optional }}optional {{ end }}enum) {{ .Description }}
3+
4+
*The following values are valid:*
5+
6+
{{ range .Enum.Values }} - `{{ .Name }}` {{ .Description }}
7+
{{ end }}
8+
{{ end -}}
79

8-
{{- define "single_attribute" -}}- `{{ .BlockName }}` ({{ if .Optional }}optional {{ end }}{{ .Type }}){{ if .Description}} {{ .Description -}}{{ end }}{{- end -}}
10+
{{- define "single_attribute" -}}- `#!css {{ .BlockName }}` ({{ if .Optional }}optional {{ end }}{{ .Type }}){{ if .Description}} {{ .Description -}}{{ end }}{{- end -}}
911

1012
{{- define "description" }}{{ if .Description }}
1113
{{ .Description }}
@@ -21,8 +23,8 @@
2123

2224
{{- define "attributes" -}}{{- range .Attributes -}}
2325
{{- if .IsCustomType }}{{ template "custom_type" . }}
24-
{{- else if .IsEnum }}{{- template "enum_attribute" . }}
25-
{{- else }}{{- template "single_attribute" . }}
26+
{{- else if .IsEnum }}{{ template "enum_attribute" . }}
27+
{{- else }}{{ template "single_attribute" . }}
2628
{{ end }}
2729
{{- end -}}
2830
{{- end -}}

‎schema/gitlab.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func (p *Property) BlockName() string {
323323
}
324324

325325
func sortSlice(i, j *Property) int {
326-
// non-custom types first
326+
// Custom types last
327327
if i.IsCustomType && j.IsCustomType {
328328
return 0
329329
}
@@ -336,5 +336,6 @@ func sortSlice(i, j *Property) int {
336336
return -1
337337
}
338338

339+
// Everything else sorted by name
339340
return cmp.Compare(i.Name, j.Name)
340341
}

‎schema/gitlab.schema.graphqls

+24-6
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ type ContextProject {
132132
# Connections
133133
#
134134

135+
"Labels available on this project"
135136
Labels: [ContextLabel!] @generated
137+
136138
ResponseLabels: ContextLabelNode @internal @graphql(key: "labels(first: 200)")
137139
MergeRequest: ContextMergeRequest @internal @graphql(key: "mergeRequest(iid: $mr_id)")
138140
ResponseGroup: ContextGroup @internal @graphql(key: "group")
@@ -247,32 +249,48 @@ type ContextMergeRequest {
247249

248250
"Changes to a single file"
249251
DiffStats: [ContextDiffStat!]
252+
"Labels available on this merge request"
250253
Labels: [ContextLabel!] @generated
251-
ResponseLabels: ContextLabelNode @internal @graphql(key: "labels(first: 200)")
252-
ResponseFirstCommits: ContextCommitsNode @internal @graphql(key: "first_commit: commits(first:1)")
253-
ResponseLastCommits: ContextCommitsNode @internal @graphql(key: "last_commit: commits(last:1)")
254-
ResponseNotes: ContextNotesNode @internal @graphql(key: "notes(last: 10)")
255254

256255
#
257256
# scm-engine customs
258257
#
259258

259+
"All notes on this MR"
260260
Notes: [ContextNote!] @generated
261+
262+
"Information about the first commit made"
261263
FirstCommit: ContextCommit @generated()
264+
"Information about the last commit made"
262265
LastCommit: ContextCommit @generated()
266+
"Duration between first and last commit made"
263267
TimeBetweenFirstAndLastCommit: Duration @generated()
268+
"Duration (from 'now') since the first commit was made"
264269
TimeSinceFirstCommit: Duration @generated()
270+
"Duration (from 'now') since the last commit was made"
265271
TimeSinceLastCommit: Duration @generated()
266272

273+
#
274+
# scm-engine internal
275+
#
276+
267277
CurrentUser: ContextUser! @generated @internal
278+
ResponseLabels: ContextLabelNode @internal @graphql(key: "labels(first: 200)")
279+
ResponseFirstCommits: ContextCommitsNode @internal @graphql(key: "first_commit: commits(first:1)")
280+
ResponseLastCommits: ContextCommitsNode @internal @graphql(key: "last_commit: commits(last:1)")
281+
ResponseNotes: ContextNotesNode @internal @graphql(key: "notes(last: 10)")
268282
}
269283

270284
# https://docs.gitlab.com/ee/api/graphql/reference/#note
271285
type ContextNote {
286+
"User who wrote the note"
287+
Author: ContextUser!
288+
"Content of the note"
272289
Body: String!
273-
UpdatedAt: Time!
290+
"Timestamp of the note creation"
274291
CreatedAt: Time!
275-
Author: ContextUser!
292+
"Timestamp of the note’s last activity"
293+
UpdatedAt: Time!
276294
}
277295

278296
# Internal only, used to de-nest connections

0 commit comments

Comments
 (0)
Please sign in to comment.