From 0a7e1306ab81d4902282038b396ef700c5b8fb64 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Tue, 3 Dec 2024 21:46:19 -0800 Subject: [PATCH] fix: move constants to constants helps with better namespacing when used downstream. --- pkg/api/openapi.go | 9 +++++---- pkg/{api => constants}/constants.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) rename pkg/{api => constants}/constants.go (98%) diff --git a/pkg/api/openapi.go b/pkg/api/openapi.go index be0f2c1..f076128 100644 --- a/pkg/api/openapi.go +++ b/pkg/api/openapi.go @@ -5,6 +5,7 @@ import ( "fmt" "strings" + "github.com/aep-dev/aep-lib-go/pkg/constants" "github.com/aep-dev/aep-lib-go/pkg/openapi" ) @@ -81,7 +82,7 @@ func ConvertToOpenAPI(api *API) (*openapi.OpenAPI, error) { }, } if r.ListMethod.HasUnreachableResources { - responseProperties[FIELD_UNREACHABLE_NAME] = openapi.Schema{ + responseProperties[constants.FIELD_UNREACHABLE_NAME] = openapi.Schema{ Type: "array", Items: &openapi.Schema{ Type: "string", @@ -92,13 +93,13 @@ func ConvertToOpenAPI(api *API) (*openapi.OpenAPI, error) { Parameters: append(pwp.Params, openapi.Parameter{ In: "query", - Name: FIELD_MAX_PAGE_SIZE_NAME, + Name: constants.FIELD_MAX_PAGE_SIZE_NAME, Required: true, Type: "integer", }, openapi.Parameter{ In: "query", - Name: FIELD_PAGE_TOKEN_NAME, + Name: constants.FIELD_PAGE_TOKEN_NAME, Required: true, Type: "string", }, @@ -159,7 +160,7 @@ func ConvertToOpenAPI(api *API) (*openapi.OpenAPI, error) { if len(r.Children) > 0 { params = append(params, openapi.Parameter{ In: "query", - Name: FIELD_FORCE_NAME, + Name: constants.FIELD_FORCE_NAME, Required: false, Type: "boolean", }) diff --git a/pkg/api/constants.go b/pkg/constants/constants.go similarity index 98% rename from pkg/api/constants.go rename to pkg/constants/constants.go index 36522d7..e940c40 100644 --- a/pkg/api/constants.go +++ b/pkg/constants/constants.go @@ -1,4 +1,4 @@ -package api +package constants const ( FIELD_FORCE_NAME = "force"