diff --git a/operation.go b/operation.go index 24b0496b2..ac79e3102 100644 --- a/operation.go +++ b/operation.go @@ -841,9 +841,9 @@ func parseObjectSchema(parser *Parser, refType string, astFile *ast.File) (*spec case refType == NIL: return nil, nil case refType == INTERFACE: - return PrimitiveSchema(OBJECT), nil + return &spec.Schema{}, nil case refType == ANY: - return PrimitiveSchema(OBJECT), nil + return &spec.Schema{}, nil case IsGolangPrimitiveType(refType): refType = TransToValidSchemeType(refType) diff --git a/operation_test.go b/operation_test.go index fb43a446e..50e4ac3b1 100644 --- a/operation_test.go +++ b/operation_test.go @@ -2448,15 +2448,16 @@ func TestParseObjectSchema(t *testing.T) { schema, err := operation.parseObjectSchema("interface{}", nil) assert.NoError(t, err) - assert.Equal(t, schema, PrimitiveSchema(OBJECT)) + assert.Equal(t, schema, &spec.Schema{}) schema, err = operation.parseObjectSchema("any", nil) assert.NoError(t, err) - assert.Equal(t, schema, PrimitiveSchema(OBJECT)) + assert.Equal(t, schema, &spec.Schema{}) schema, err = operation.parseObjectSchema("any{data=string}", nil) assert.NoError(t, err) - assert.Equal(t, schema, PrimitiveSchema(OBJECT).SetProperty("data", *PrimitiveSchema("string"))) + assert.Equal(t, schema, + (&spec.Schema{}).WithAllOf(spec.Schema{}, *PrimitiveSchema(OBJECT).SetProperty("data", *PrimitiveSchema("string")))) schema, err = operation.parseObjectSchema("int", nil) assert.NoError(t, err)