Skip to content

Commit 87b2c66

Browse files
author
Chris Vermeulen
authored
Feature fix parent bug for controls (#176)
* Add catalog to parent details * Pass back empty arrays when nothing is found * Ensure only class is listed after unwind * Update docs
1 parent 5dd2322 commit 87b2c66

File tree

12 files changed

+183
-262
lines changed

12 files changed

+183
-262
lines changed

docs/docs.go

Lines changed: 30 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const docTemplate = `{
229229
}
230230
}
231231
},
232-
"/controls/children/{class}/{id}": {
232+
"/controls/control/{catalog}/{class}/{id}": {
233233
"get": {
234234
"description": "Retrieves catalog controls associated with a control parent based on the parent's class and id.",
235235
"produces": [
@@ -240,6 +240,13 @@ const docTemplate = `{
240240
],
241241
"summary": "Get catalog controls for a control parent",
242242
"parameters": [
243+
{
244+
"type": "string",
245+
"description": "Catalog ID",
246+
"name": "catalog",
247+
"in": "path",
248+
"required": true
249+
},
243250
{
244251
"type": "string",
245252
"description": "Parent control class",
@@ -283,7 +290,7 @@ const docTemplate = `{
283290
}
284291
}
285292
},
286-
"/controls/group/{class}/{id}": {
293+
"/controls/group/{catalog}/{class}/{id}": {
287294
"get": {
288295
"description": "Retrieves catalog controls associated with a group parent based on the parent's class and id.",
289296
"produces": [
@@ -296,14 +303,21 @@ const docTemplate = `{
296303
"parameters": [
297304
{
298305
"type": "string",
299-
"description": "Parent group class",
306+
"description": "Catalog ID",
307+
"name": "catalog",
308+
"in": "path",
309+
"required": true
310+
},
311+
{
312+
"type": "string",
313+
"description": "Parent control class",
300314
"name": "class",
301315
"in": "path",
302316
"required": true
303317
},
304318
{
305319
"type": "string",
306-
"description": "Parent group id",
320+
"description": "Parent control id",
307321
"name": "id",
308322
"in": "path",
309323
"required": true
@@ -825,62 +839,7 @@ const docTemplate = `{
825839
}
826840
}
827841
},
828-
"/groups": {
829-
"get": {
830-
"description": "Retrieves catalog groups based on the provided parent identifier query parameters (id, class, type).",
831-
"produces": [
832-
"application/json"
833-
],
834-
"tags": [
835-
"CatalogGroups"
836-
],
837-
"summary": "List catalog groups by parent",
838-
"parameters": [
839-
{
840-
"type": "string",
841-
"description": "Parent identifier ID",
842-
"name": "id",
843-
"in": "query",
844-
"required": true
845-
},
846-
{
847-
"type": "string",
848-
"description": "Parent identifier class",
849-
"name": "class",
850-
"in": "query",
851-
"required": true
852-
},
853-
{
854-
"type": "string",
855-
"description": "Parent identifier type (catalog, group, etc.)",
856-
"name": "type",
857-
"in": "query",
858-
"required": true
859-
}
860-
],
861-
"responses": {
862-
"200": {
863-
"description": "OK",
864-
"schema": {
865-
"$ref": "#/definitions/handler.GenericDataListResponse-service_CatalogGroup"
866-
}
867-
},
868-
"400": {
869-
"description": "Bad Request",
870-
"schema": {
871-
"$ref": "#/definitions/api.Error"
872-
}
873-
},
874-
"500": {
875-
"description": "Internal Server Error",
876-
"schema": {
877-
"$ref": "#/definitions/api.Error"
878-
}
879-
}
880-
}
881-
}
882-
},
883-
"/groups/catalog/{id}": {
842+
"/groups/catalog/{catalog}": {
884843
"get": {
885844
"description": "Retrieves catalog groups that belong to a catalog, identified by its unique catalog ID.",
886845
"produces": [
@@ -894,7 +853,7 @@ const docTemplate = `{
894853
{
895854
"type": "string",
896855
"description": "Catalog ID",
897-
"name": "id",
856+
"name": "catalog",
898857
"in": "path",
899858
"required": true
900859
}
@@ -938,6 +897,13 @@ const docTemplate = `{
938897
],
939898
"summary": "Get catalog groups for a group parent",
940899
"parameters": [
900+
{
901+
"type": "string",
902+
"description": "Catalog ID",
903+
"name": "catalog",
904+
"in": "path",
905+
"required": true
906+
},
941907
{
942908
"type": "string",
943909
"description": "Parent group class",
@@ -2119,6 +2085,9 @@ const docTemplate = `{
21192085
"service.CatalogItemParentIdentifier": {
21202086
"type": "object",
21212087
"properties": {
2088+
"catalog_id": {
2089+
"type": "string"
2090+
},
21222091
"class": {
21232092
"type": "string"
21242093
},

docs/swagger.json

Lines changed: 30 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
}
224224
}
225225
},
226-
"/controls/children/{class}/{id}": {
226+
"/controls/control/{catalog}/{class}/{id}": {
227227
"get": {
228228
"description": "Retrieves catalog controls associated with a control parent based on the parent's class and id.",
229229
"produces": [
@@ -234,6 +234,13 @@
234234
],
235235
"summary": "Get catalog controls for a control parent",
236236
"parameters": [
237+
{
238+
"type": "string",
239+
"description": "Catalog ID",
240+
"name": "catalog",
241+
"in": "path",
242+
"required": true
243+
},
237244
{
238245
"type": "string",
239246
"description": "Parent control class",
@@ -277,7 +284,7 @@
277284
}
278285
}
279286
},
280-
"/controls/group/{class}/{id}": {
287+
"/controls/group/{catalog}/{class}/{id}": {
281288
"get": {
282289
"description": "Retrieves catalog controls associated with a group parent based on the parent's class and id.",
283290
"produces": [
@@ -290,14 +297,21 @@
290297
"parameters": [
291298
{
292299
"type": "string",
293-
"description": "Parent group class",
300+
"description": "Catalog ID",
301+
"name": "catalog",
302+
"in": "path",
303+
"required": true
304+
},
305+
{
306+
"type": "string",
307+
"description": "Parent control class",
294308
"name": "class",
295309
"in": "path",
296310
"required": true
297311
},
298312
{
299313
"type": "string",
300-
"description": "Parent group id",
314+
"description": "Parent control id",
301315
"name": "id",
302316
"in": "path",
303317
"required": true
@@ -819,62 +833,7 @@
819833
}
820834
}
821835
},
822-
"/groups": {
823-
"get": {
824-
"description": "Retrieves catalog groups based on the provided parent identifier query parameters (id, class, type).",
825-
"produces": [
826-
"application/json"
827-
],
828-
"tags": [
829-
"CatalogGroups"
830-
],
831-
"summary": "List catalog groups by parent",
832-
"parameters": [
833-
{
834-
"type": "string",
835-
"description": "Parent identifier ID",
836-
"name": "id",
837-
"in": "query",
838-
"required": true
839-
},
840-
{
841-
"type": "string",
842-
"description": "Parent identifier class",
843-
"name": "class",
844-
"in": "query",
845-
"required": true
846-
},
847-
{
848-
"type": "string",
849-
"description": "Parent identifier type (catalog, group, etc.)",
850-
"name": "type",
851-
"in": "query",
852-
"required": true
853-
}
854-
],
855-
"responses": {
856-
"200": {
857-
"description": "OK",
858-
"schema": {
859-
"$ref": "#/definitions/handler.GenericDataListResponse-service_CatalogGroup"
860-
}
861-
},
862-
"400": {
863-
"description": "Bad Request",
864-
"schema": {
865-
"$ref": "#/definitions/api.Error"
866-
}
867-
},
868-
"500": {
869-
"description": "Internal Server Error",
870-
"schema": {
871-
"$ref": "#/definitions/api.Error"
872-
}
873-
}
874-
}
875-
}
876-
},
877-
"/groups/catalog/{id}": {
836+
"/groups/catalog/{catalog}": {
878837
"get": {
879838
"description": "Retrieves catalog groups that belong to a catalog, identified by its unique catalog ID.",
880839
"produces": [
@@ -888,7 +847,7 @@
888847
{
889848
"type": "string",
890849
"description": "Catalog ID",
891-
"name": "id",
850+
"name": "catalog",
892851
"in": "path",
893852
"required": true
894853
}
@@ -932,6 +891,13 @@
932891
],
933892
"summary": "Get catalog groups for a group parent",
934893
"parameters": [
894+
{
895+
"type": "string",
896+
"description": "Catalog ID",
897+
"name": "catalog",
898+
"in": "path",
899+
"required": true
900+
},
935901
{
936902
"type": "string",
937903
"description": "Parent group class",
@@ -2113,6 +2079,9 @@
21132079
"service.CatalogItemParentIdentifier": {
21142080
"type": "object",
21152081
"properties": {
2082+
"catalog_id": {
2083+
"type": "string"
2084+
},
21162085
"class": {
21172086
"type": "string"
21182087
},

0 commit comments

Comments
 (0)