From 0adc8873f4a4fa0eea4276038555e29c129a1778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20S=C5=82onka?= Date: Tue, 7 Jan 2025 13:36:20 +0100 Subject: [PATCH] chore(oapi): move global inisight schema to separate object (#12456) ## Motivation So it's properly merged in parent object. Otherwise we end up with both `properties` and `allOf` on the same level which doesn't play nicely with parent project validator. ## Implementation information Move to separate object. ## Supporting documentation xrel https://github.com/kumahq/ci-tools/issues/59 --------- Signed-off-by: slonka --- api/openapi/specs/api.yaml | 5 ++- api/openapi/types/zz_generated.api.go | 49 ++++++++++++++------------- docs/generated/openapi.yaml | 5 ++- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/api/openapi/specs/api.yaml b/api/openapi/specs/api.yaml index 76551cf89aa5..1db075127b63 100644 --- a/api/openapi/specs/api.yaml +++ b/api/openapi/specs/api.yaml @@ -390,7 +390,7 @@ components: type: integer description: Number of meshes example: 3 - GlobalInsight: + schemas-GlobalInsight: type: object title: GlobalInsight description: Global Insight contains statistics for all main resources @@ -433,6 +433,9 @@ components: additionalProperties: $ref: '#/components/schemas/ResourceStats' description: A map of resource names to their corresponding statistics + GlobalInsight: + allOf: + - $ref: '#/components/schemas/schemas-GlobalInsight' responses: IndexResponse: description: A response for the index endpoint diff --git a/api/openapi/types/zz_generated.api.go b/api/openapi/types/zz_generated.api.go index 9a244a77d09c..f319e1bfc539 100644 --- a/api/openapi/types/zz_generated.api.go +++ b/api/openapi/types/zz_generated.api.go @@ -47,28 +47,7 @@ type FullStatus struct { } // GlobalInsight Global Insight contains statistics for all main resources -type GlobalInsight struct { - // CreatedAt Time of Global Insight creation - CreatedAt time.Time `json:"createdAt"` - - // Dataplanes Dataplane proxy statistics - Dataplanes DataplanesStats `json:"dataplanes"` - - // Meshes Mesh statistics - Meshes MeshesStats `json:"meshes"` - - // Policies Policies statistics - Policies PoliciesStats `json:"policies"` - - // Resources A map of resource names to their corresponding statistics - Resources map[string]ResourceStats `json:"resources"` - - // Services Mesh services statistics - Services ServicesStats `json:"services"` - - // Zones Zones statistics - Zones ZonesStats `json:"zones"` -} +type GlobalInsight = SchemasGlobalInsight // Index Some metadata about the service type Index struct { @@ -168,10 +147,34 @@ type ZonesStats struct { ZoneIngresses BaseStatus `json:"zoneIngresses"` } +// SchemasGlobalInsight Global Insight contains statistics for all main resources +type SchemasGlobalInsight struct { + // CreatedAt Time of Global Insight creation + CreatedAt time.Time `json:"createdAt"` + + // Dataplanes Dataplane proxy statistics + Dataplanes DataplanesStats `json:"dataplanes"` + + // Meshes Mesh statistics + Meshes MeshesStats `json:"meshes"` + + // Policies Policies statistics + Policies PoliciesStats `json:"policies"` + + // Resources A map of resource names to their corresponding statistics + Resources map[string]ResourceStats `json:"resources"` + + // Services Mesh services statistics + Services ServicesStats `json:"services"` + + // Zones Zones statistics + Zones ZonesStats `json:"zones"` +} + // BadRequest standard error type BadRequest = externalRef0.Error -// GlobalInsightResponse Global Insight contains statistics for all main resources +// GlobalInsightResponse defines model for GlobalInsightResponse. type GlobalInsightResponse = GlobalInsight // IndexResponse Some metadata about the service diff --git a/docs/generated/openapi.yaml b/docs/generated/openapi.yaml index 23b075a507fe..2ac47623cb64 100644 --- a/docs/generated/openapi.yaml +++ b/docs/generated/openapi.yaml @@ -2448,7 +2448,7 @@ components: type: integer description: Number of meshes example: 3 - GlobalInsight: + schemas-GlobalInsight: type: object title: GlobalInsight description: Global Insight contains statistics for all main resources @@ -2491,6 +2491,9 @@ components: additionalProperties: $ref: '#/components/schemas/ResourceStats' description: A map of resource names to their corresponding statistics + GlobalInsight: + allOf: + - $ref: '#/components/schemas/schemas-GlobalInsight' PolicyDescription: type: object required: