fix: support recursive response DTOs and release v0.28.2

This commit is contained in:
2026-09-30 12:56:34 +08:00
parent f2c5957c15
commit 0c5b571b31
24 changed files with 978 additions and 91 deletions

View File

@@ -2,6 +2,7 @@ package openapi
import (
"encoding/json"
"reflect"
"strings"
"testing"
@@ -14,6 +15,8 @@ func TestSchemaAdditionalPropertiesAndExactNumbers(t *testing.T) {
`{"type":"object","additionalProperties":true}`,
`{"type":"object","additionalProperties":{"type":"string"}}`,
`{"type":"integer","default":18446744073709551615,"enum":[18446744073709551615]}`,
`{"$ref":"#/components/schemas/Node"}`,
`{"description":"Node","allOf":[{"anyOf":[{"$ref":"#/components/schemas/Node"},{"type":"object","nullable":true,"enum":[null]}]}]}`,
} {
var s Schema
if err := json.Unmarshal([]byte(text), &s); err != nil {
@@ -30,6 +33,9 @@ func TestSchemaAdditionalPropertiesAndExactNumbers(t *testing.T) {
if err = json.Unmarshal(b, &roundTrip); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(s, roundTrip) {
t.Fatalf("schema round trip changed: %s", b)
}
}
api, _ := New("Exact numbers", "1")
s := &Schema{Type: "integer", Enum: []any{json.Number("18446744073709551615")}}