Skip to content

TypeFactory maps object types with defined/undefined class name as JSON-Schema "type": "string" #3403

@Ocramius

Description

@Ocramius

API Platform version(s) affected: 2.5.x

Description

In our tests for TypeFactory:

        yield [['type' => 'string'], new Type(Type::BUILTIN_TYPE_OBJECT)];
        yield [['type' => 'string'], new Type(Type::BUILTIN_TYPE_OBJECT, true)];

// ...

        yield [['type' => 'string'], new Type(Type::BUILTIN_TYPE_OBJECT, false, Dummy::class)];
        yield [['type' => 'string'], new Type(Type::BUILTIN_TYPE_OBJECT, true, Dummy::class)];

While reviewing #3402, @dunglas found a potential BC break with objects that may be used in URIs as strings (therefore not objects):

How to reproduce

The test should instead convert object to object:

        yield [['type' => 'object'], new Type(Type::BUILTIN_TYPE_OBJECT)];
        yield [['type' => 'object'], new Type(Type::BUILTIN_TYPE_OBJECT, true)];

// ...

        yield [['type' => 'object'], new Type(Type::BUILTIN_TYPE_OBJECT, false, Dummy::class)];
        yield [['type' => 'object'], new Type(Type::BUILTIN_TYPE_OBJECT, true, Dummy::class)];

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions