Skip to content

Resource properties configuration in YAML doesn't work #5482

@maxtorete

Description

@maxtorete

API Platform version(s) affected: 3.1.0

Description
I tried to set the openapiContext property in a Yaml file, but it doesn't work. It woks fine in XML, even if I set the resource in a YAML file and the properties in XML.

How to reproduce
Try this conf from docs:

properties:
    App\Entity\Product:
        timestamp:
            attributes:
                openapiContext:
                    type: string
                    format: date-time

Property's openapiContext configuration is ignored. And then try the same configuration but in XML format, also taken from docs:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/properties.xml -->

<properties xmlns="https://api-platform.com/schema/metadata/properties-3.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="https://api-platform.com/schema/metadata/properties-3.0
           https://api-platform.com/schema/metadata/properties-3.0.xsd">
    <property resource="App\Entity\Product" name="timestamp">
        <openapiContext>
            <values>
                <value name="type">string</value>
                <value name="format">date-time</value>
            </values>
        </openapiContext>
    </property>
</properties>

And this one works just fine. Resource shows the date-time format for timestamp property in SwaggerUI.

PS: I also tried removing the attributes key as I don't see it on YamlPropertyExtractor, but it doesn't work either.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions