fix: support recursive response DTOs and release v0.28.2
This commit is contained in:
@@ -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")}}
|
||||
|
||||
Reference in New Issue
Block a user