Skip to content

HeaderParameter and validation not coherent #7111

Open
@Grummfy

Description

@Grummfy

API Platform version(s) affected: 3.4 -> 4.1.x
tested with my project (3.4) and validated that it still exist with master of api-platform/api-platform so I assume 4.x

Description
HeaderParameter constraint seems not coherent. Here, I tested the validation of an header parameter for the api. It seems to be inconsistent.

  • checking that it's required : worked great
  • checking that my value is less or equals than X : work great on the openapi front part, not on back part (no validation)
  • checking that my value is an integer : work great on the openapi front part, not on back part
  • checking that my value is greater or equals than X : failed

How to reproduce

I took the demo project, and on the greeting entity I have make this change

#[ApiResource(mercure: true)]
to
#[ApiResource(mercure: true, parameters: ['Foo' => new HeaderParameter(schema: ['type' => 'integer', 'example' => 3, 'minimum' => 1, 'maximum' => 5], required: true)])]

to check each test, maximum need to be removed to test the other constraint

Possible Solution
validation on the value of the array ?

Additional Context
Perhaps I missuses the HeaderParameter ? But the output in openApi format seems coherent

The constraint is applied on an array (don't know why an array instead of the value), so perhaps it's the reason of the behaviour?

thanks

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