From 86e9d7c5f9b56207b226db292c4a3441b093a808 Mon Sep 17 00:00:00 2001 From: Amirhossein Khalili Date: Fri, 21 Aug 2026 01:46:11 +0330 Subject: [PATCH] fix: keep growth report refresh optional --- docs/openapi.yaml | 4 +++- docs/openapi_test.go | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 docs/openapi_test.go diff --git a/docs/openapi.yaml b/docs/openapi.yaml index ee973a7..7d58641 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1008,7 +1008,9 @@ components: additionalProperties: false properties: terminalId: {type: string, minLength: 1, maxLength: 128} - refresh: {type: boolean, default: false} + refresh: + type: boolean + description: When omitted, the request reuses the current matching report. GrowthRange: type: object additionalProperties: false diff --git a/docs/openapi_test.go b/docs/openapi_test.go new file mode 100644 index 0000000..3ca0c9e --- /dev/null +++ b/docs/openapi_test.go @@ -0,0 +1,36 @@ +package docs + +import ( + "os" + "strings" + "testing" +) + +func TestCreateGrowthReportRequestFieldsAreOptional(t *testing.T) { + t.Parallel() + + document, err := os.ReadFile("openapi.yaml") + if err != nil { + t.Fatalf("read OpenAPI document: %v", err) + } + + const schemaStart = " CreateGrowthReportRequest:\n" + const nextSchema = " GrowthRange:\n" + start := strings.Index(string(document), schemaStart) + if start < 0 { + t.Fatal("CreateGrowthReportRequest schema not found") + } + schema := string(document)[start+len(schemaStart):] + var found bool + schema, _, found = strings.Cut(schema, nextSchema) + if !found { + t.Fatal("schema following CreateGrowthReportRequest not found") + } + + if strings.Contains(schema, "required:") { + t.Fatalf("optional request fields must not be listed as required:\n%s", schema) + } + if strings.Contains(schema, "default:") { + t.Fatalf("optional request fields must not use defaults that generators treat as required:\n%s", schema) + } +}