Skip to content

Commit 297136e

Browse files
authored
feat: removal of custom core group (#114)
* feat: improve subscription handling (#55) * feat: improve subscription handling (#55) * feat: add tests for subscription handling (#55) * feat: adjust method description (#55) * feat: include version in generated queries/mutations (#108) * feat: include version in generated queries/mutations (#108) * feat: removal of custom core group (#111) * fix: address PR comments (#111) * fix: address PR comments (#111) * fix: address PR comments (#111)
1 parent f46122e commit 297136e

File tree

13 files changed

+283
-291
lines changed

13 files changed

+283
-291
lines changed

cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package cmd
33
import (
44
pmconfig "github.com/platform-mesh/golang-commons/config"
55
"github.com/platform-mesh/golang-commons/logger"
6+
"github.com/platform-mesh/kubernetes-graphql-gateway/common/config"
67
"github.com/spf13/cobra"
78
"github.com/spf13/viper"
8-
9-
"github.com/platform-mesh/kubernetes-graphql-gateway/common/config"
109
)
1110

1211
var (

docs/breaking-changes.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GraphQL queries and mutations are now organized under `group → version → res
88

99
- Core group examples:
1010
- Before: `core { ConfigMaps { ... } }`
11-
- Now: `core { v1 { ConfigMaps { ... } } }`
11+
- Now: `v1 { ConfigMaps { ... } }`
1212

1313
- Non-core groups (dots replaced by underscores):
1414
- Before: `openmfp_org { Accounts { ... } }`
@@ -18,36 +18,34 @@ Plural list fields now return a wrapper object with pagination metadata:
1818

1919
```graphql
2020
query {
21-
core {
22-
v1 {
23-
ConfigMaps {
24-
resourceVersion
25-
continue
26-
remainingItemCount
27-
items { metadata { name namespace resourceVersion } }
28-
}
21+
v1 {
22+
ConfigMaps {
23+
resourceVersion
24+
continue
25+
remainingItemCount
26+
items { metadata { name namespace resourceVersion } }
2927
}
3028
}
3129
}
3230
```
3331

3432
## Subscriptions: flat and versioned field names
3533

36-
Subscriptions remain flat but now include the version in the field name: `<group>_<version>_<resource>`.
34+
Subscriptions remain flat and versioned. Core resources no longer include the artificial `core` group in the flattened name.
3735

38-
- Core examples: `core_v1_configmaps`, `core_v1_configmap`
36+
- Core examples: `v1_configmaps`, `v1_configmap`
3937
- Non-core examples: `openmfp_org_v1alpha1_accounts`, `openmfp_org_v1alpha1_account`
4038

4139
Subscriptions use Server‑Sent Events (SSE). GraphiQL/Playground typically do not support SSE subscriptions. Use curl/Postman/Insomnia or a custom EventSource client.
4240

43-
Example:
41+
Example (core):
4442

4543
```sh
4644
curl \
4745
-H "Accept: text/event-stream" \
4846
-H "Content-Type: application/json" \
4947
-d '{
50-
"query": "subscription { core_v1_configmaps { type object { metadata { name namespace resourceVersion } } } }"
48+
"query": "subscription { v1_configmaps { type object { metadata { name namespace resourceVersion } } } }"
5149
}' \
5250
$GRAPHQL_URL
5351
```
@@ -58,6 +56,7 @@ To start from a known list `resourceVersion`, fetch it via a list query and pass
5856

5957
- Legacy flat query/mutation names have been removed.
6058
- Old unversioned subscription names have been removed.
59+
- Core flattened subscription names changed from `core_v1_*` to `v1_*`.
6160

6261
Please update your client queries accordingly. See detailed examples:
6362

docs/configmap_queries.md

Lines changed: 46 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ For questions on how to execute them, please find our [Quick Start Guide](./quic
66
## Create a ConfigMap:
77
```shell
88
mutation {
9-
core {
10-
v1 {
11-
createConfigMap(
12-
namespace: "default",
13-
object: {
14-
metadata: {
15-
name: "example-config"
16-
},
17-
data: { key: "val" }
18-
}
19-
) {
20-
metadata {
21-
name
22-
}
23-
data
9+
v1 {
10+
createConfigMap(
11+
namespace: "default",
12+
object: {
13+
metadata: {
14+
name: "example-config"
15+
},
16+
data: { key: "val" }
17+
}
18+
) {
19+
metadata {
20+
name
2421
}
22+
data
2523
}
2624
}
2725
}
@@ -30,20 +28,18 @@ mutation {
3028
## List ConfigMaps:
3129
```shell
3230
query {
33-
core {
34-
v1 {
35-
ConfigMaps {
36-
resourceVersion
37-
continue
38-
remainingItemCount
39-
items {
40-
metadata {
41-
name
42-
namespace
43-
resourceVersion
44-
}
45-
data
31+
v1 {
32+
ConfigMaps {
33+
resourceVersion
34+
continue
35+
remainingItemCount
36+
items {
37+
metadata {
38+
name
39+
namespace
40+
resourceVersion
4641
}
42+
data
4743
}
4844
}
4945
}
@@ -53,14 +49,12 @@ query {
5349
## Get a ConfigMap:
5450
```shell
5551
{
56-
core {
57-
v1 {
58-
ConfigMap(name: "example-config", namespace: "default") {
59-
metadata {
60-
name
61-
}
62-
data
52+
v1 {
53+
ConfigMap(name: "example-config", namespace: "default") {
54+
metadata {
55+
name
6356
}
57+
data
6458
}
6559
}
6660
}
@@ -69,21 +63,19 @@ query {
6963
## Update a ConfigMap:
7064
```shell
7165
mutation {
72-
core {
73-
v1 {
74-
updateConfigMap(
75-
name:"example-config"
76-
namespace: "default",
77-
object: {
78-
data: { key: "new-value" }
79-
}
80-
) {
81-
metadata {
82-
name
83-
namespace
84-
}
85-
data
66+
v1 {
67+
updateConfigMap(
68+
name:"example-config"
69+
namespace: "default",
70+
object: {
71+
data: { key: "new-value" }
72+
}
73+
) {
74+
metadata {
75+
name
76+
namespace
8677
}
78+
data
8779
}
8880
}
8981
}
@@ -92,13 +84,11 @@ mutation {
9284
## Delete a ConfigMap:
9385
```shell
9486
mutation {
95-
core {
96-
v1 {
97-
deleteConfigMap(
98-
name: "example-config",
99-
namespace: "default"
100-
)
101-
}
87+
v1 {
88+
deleteConfigMap(
89+
name: "example-config",
90+
namespace: "default"
91+
)
10292
}
10393
}
10494
```

docs/pod_queries.md

Lines changed: 53 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,49 @@ For questions on how to execute them, please find our [Quick Start Guide](./quic
66
## Create a Pod:
77
```shell
88
mutation {
9-
core {
10-
v1 {
11-
createPod(
12-
namespace: "default",
13-
object: {
14-
metadata: {
15-
name: "my-new-pod",
16-
labels: {
17-
app: "my-app"
18-
}
19-
}
20-
spec: {
21-
containers: [
22-
{
23-
name: "nginx-container"
24-
image: "nginx:latest"
25-
ports: [
26-
{
27-
containerPort: 80
28-
}
29-
]
30-
}
31-
]
32-
restartPolicy: "Always"
9+
v1 {
10+
createPod(
11+
namespace: "default",
12+
object: {
13+
metadata: {
14+
name: "my-new-pod",
15+
labels: {
16+
app: "my-app"
3317
}
3418
}
35-
) {
36-
metadata {
37-
name
38-
namespace
39-
labels
40-
}
41-
spec {
42-
containers {
43-
name
44-
image
45-
ports {
46-
containerPort
19+
spec: {
20+
containers: [
21+
{
22+
name: "nginx-container"
23+
image: "nginx:latest"
24+
ports: [
25+
{
26+
containerPort: 80
27+
}
28+
]
4729
}
48-
}
49-
restartPolicy
30+
]
31+
restartPolicy: "Always"
5032
}
51-
status {
52-
phase
33+
}
34+
) {
35+
metadata {
36+
name
37+
namespace
38+
labels
39+
}
40+
spec {
41+
containers {
42+
name
43+
image
44+
ports {
45+
containerPort
46+
}
5347
}
48+
restartPolicy
49+
}
50+
status {
51+
phase
5452
}
5553
}
5654
}
@@ -60,18 +58,16 @@ mutation {
6058
## Get the Created Pod:
6159
```shell
6260
query {
63-
core {
64-
v1 {
65-
Pod(name:"my-new-pod", namespace:"default") {
66-
metadata {
67-
name
68-
}
69-
spec{
70-
containers {
71-
image
72-
ports {
73-
containerPort
74-
}
61+
v1 {
62+
Pod(name:"my-new-pod", namespace:"default") {
63+
metadata {
64+
name
65+
}
66+
spec{
67+
containers {
68+
image
69+
ports {
70+
containerPort
7571
}
7672
}
7773
}
@@ -83,13 +79,11 @@ query {
8379
## Delete the Created Pod:
8480
```shell
8581
mutation {
86-
core {
87-
v1 {
88-
deletePod(
89-
namespace: "default",
90-
name: "my-new-pod"
91-
)
92-
}
82+
v1 {
83+
deletePod(
84+
namespace: "default",
85+
name: "my-new-pod"
86+
)
9387
}
9488
}
9589
```

0 commit comments

Comments
 (0)