Skip to content

Attempted to call an undefined method named "getNativeType" of class "ApiPlatform\Metadata\ApiProperty"Β #7404

@coissay

Description

@coissay

API Platform version(s) affected: 4.1.24

Description
I am using a custom serializer that implements DenormalizerInterface, NormalizerInterface. in order to add translation when denormalize my json. Then i send it to an ObjectNormalizer $objectNormalizer.

Since the update from 4.1.23 to 4.1.24 i got the following error:
Attempted to call an undefined method named "getNativeType" of class "ApiPlatform\Metadata\ApiProperty".
in vendor/api-platform/serializer/AbstractItemNormalizer.php (line 881)
when $type = $propertyMetadata->getNativeType(); is called

How to reproduce
update your version and setup a custom normalizer call, the issue come from a method called inside the vendor of ApiPlatform so i guess this should trigger the error

Possible Solution
get the native type by using getBuiltinType instead ?

Additional Context
Linked to: api-platform/api-platform#2934
response.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions