fix: keep growth report refresh optional
This commit is contained in:
@@ -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
36
docs/openapi_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user