Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Ocramius opened this issue Feb 20, 2020 · 2 comments

Comments

@Ocramius
Copy link
Contributor

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)];
Ocramius added a commit to Ocramius/core that referenced this issue Feb 20, 2020
…": "string"}`

To avoid BC breaks, we defer this fix to api-platform#3403

> **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 api-platform#3402, @dunglas found a potential BC break with objects that may be used in URIs as `string`s (therefore not `objects`):
>
>     * [api-platform#3402 (comment)](api-platform#3402 (comment))
>
>     * [api-platform#3402 (comment)](api-platform#3402 (comment))
>
>
> **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)];
> ```
teohhanhui pushed a commit to Ocramius/core that referenced this issue Feb 27, 2020
…": "string"}`

To avoid BC breaks, we defer this fix to api-platform#3403

> **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 api-platform#3402, @dunglas found a potential BC break with objects that may be used in URIs as `string`s (therefore not `objects`):
>
>     * [api-platform#3402 (comment)](api-platform#3402 (comment))
>
>     * [api-platform#3402 (comment)](api-platform#3402 (comment))
>
>
> **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)];
> ```
@stale
Copy link

stale bot commented Nov 5, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 5, 2022
@stale
Copy link

stale bot commented Jan 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 4, 2023
@stale stale bot closed this as completed Jan 11, 2023
soyuka pushed a commit to api-platform/json-schema that referenced this issue Mar 21, 2023
…": "string"}`

To avoid BC breaks, we defer this fix to api-platform/core#3403

> **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 `string`s (therefore not `objects`):
>
>     * [#3402 (comment)](api-platform/core#3402 (comment))
>
>     * [#3402 (comment)](api-platform/core#3402 (comment))
>
>
> **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)];
> ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant