fix: keep growth report refresh optional

This commit is contained in:
2026-08-21 01:46:11 +03:30
parent 066adcfd1a
commit 86e9d7c5f9
2 changed files with 39 additions and 1 deletions

View File

@@ -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

36
docs/openapi_test.go Normal file
View File

@@ -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)
}
}