From 896c6be103ee30bb940347de08d8cd74e4f00845 Mon Sep 17 00:00:00 2001 From: "Chang, Hui-Tang" Date: Wed, 6 Dec 2023 22:54:25 +0800 Subject: [PATCH] chore(core): refactor CheckNamespace endpoint and fix typo --- core/mgmt/v1beta/mgmt.proto | 17 ++++------- core/mgmt/v1beta/mgmt_public_service.proto | 2 +- openapiv2/openapiv2.swagger.yaml | 33 +++++++++++----------- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/core/mgmt/v1beta/mgmt.proto b/core/mgmt/v1beta/mgmt.proto index cc950585..dc07c3da 100644 --- a/core/mgmt/v1beta/mgmt.proto +++ b/core/mgmt/v1beta/mgmt.proto @@ -312,21 +312,16 @@ message PatchAuthenticatedUserResponse { } // CheckNamespaceRequest represents a request to verify if -// a namespace has been occupied and know its type +// a namespace has been occupied message CheckNamespaceRequest { - // CheckNamespaceRequestBody - message CheckNamespaceRequestBody { - // The resource id of to check, - string id = 1 [(google.api.field_behavior) = REQUIRED]; - } - // body - CheckNamespaceRequestBody namespace = 1 [(google.api.field_behavior) = REQUIRED]; + // Namespace ID to be checked + string id = 1 [(google.api.field_behavior) = REQUIRED]; } // CheckNamespaceResponse represents a response about whether -// the queried username has been occupied +// the queried namespace has been occupied and return its type message CheckNamespaceResponse { - // Namespace type + // Namespace type enum enum Namespace { // UNSPECIFIED NAMESPACE_UNSPECIFIED = 0; @@ -339,7 +334,7 @@ message CheckNamespaceResponse { // Reserved NAMESPACE_RESERVED = 4; } - // A boolean value indicating whether the username has been occupied + // Namespace type Namespace type = 1; } diff --git a/core/mgmt/v1beta/mgmt_public_service.proto b/core/mgmt/v1beta/mgmt_public_service.proto index 62c8e97b..64d67c03 100644 --- a/core/mgmt/v1beta/mgmt_public_service.proto +++ b/core/mgmt/v1beta/mgmt_public_service.proto @@ -38,7 +38,7 @@ service MgmtPublicService { rpc CheckNamespace(CheckNamespaceRequest) returns (CheckNamespaceResponse) { option (google.api.http) = { post: "/v1beta/check-namespace" - body: "namespace" + body: "*" }; option (google.api.method_signature) = "namespace"; } diff --git a/openapiv2/openapiv2.swagger.yaml b/openapiv2/openapiv2.swagger.yaml index c8cc85aa..1e76a068 100644 --- a/openapiv2/openapiv2.swagger.yaml +++ b/openapiv2/openapiv2.swagger.yaml @@ -5399,14 +5399,11 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: namespace - description: body + - name: body in: body required: true schema: - $ref: '#/definitions/CheckNamespaceRequestCheckNamespaceRequestBody' - required: - - namespace + $ref: '#/definitions/v1betaCheckNamespaceRequest' tags: - MgmtPublicService /v1beta/connector-definitions: @@ -6280,15 +6277,6 @@ definitions: format: int32 title: exp title: UnsignedAccessToken - CheckNamespaceRequestCheckNamespaceRequestBody: - type: object - properties: - id: - type: string - title: The resource id of to check, - title: CheckNamespaceRequestBody - required: - - id CheckNamespaceResponseNamespace: type: string enum: @@ -6304,7 +6292,7 @@ definitions: - NAMESPACE_USER: User - NAMESPACE_ORGANIZATION: Org - NAMESPACE_RESERVED: Reserved - title: Namespace type + title: Namespace type enum HealthCheckResponseServingStatus: type: string enum: @@ -8327,15 +8315,26 @@ definitions: title: |- CheckConnectorResponse represents a response to fetch a connector's current state + v1betaCheckNamespaceRequest: + type: object + properties: + id: + type: string + title: Namespace ID to be checked + title: |- + CheckNamespaceRequest represents a request to verify if + a namespace has been occupied + required: + - id v1betaCheckNamespaceResponse: type: object properties: type: $ref: '#/definitions/CheckNamespaceResponseNamespace' - title: A boolean value indicating whether the username has been occupied + title: Namespace type title: |- CheckNamespaceResponse represents a response about whether - the queried username has been occupied + the queried namespace has been occupied and return its type v1betaComponent: type: object properties: