Skip to content

[BUG] php-symfony model templates using wrong variable for validation annotation (minimum where should be maximum) #13060

@plotbox-io

Description

@plotbox-io
Description

Problem found in file: modules/openapi-generator/src/main/resources/php-symfony/model_variables.mustache.

{{#minimum}}
    {{#exclusiveMinimum}}
     * @Assert\GreaterThan({{minimum}})
    {{/exclusiveMinimum}}
    {{^exclusiveMinimum}}
     * @Assert\GreaterThanOrEqual({{minimum}})
    {{/exclusiveMinimum}}
    {{/minimum}}
    {{#maximum}}
    {{#exclusiveMaximum}}
     * @Assert\LessThan({{minimum}})
    {{/exclusiveMaximum}}
    {{^exclusiveMaximum}}
     * @Assert\LessThanOrEqual({{minimum}})
    {{/exclusiveMaximum}}
    {{/maximum}}

Looks like a copy paste error. The two lower instances of minimum here should instead be maximum. This causes validation to fail in cases where it should not according to the openapi spec.

Suggest a fix

Submitting PR to fix the template

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