Skip to content

Allowable values not returned correctly in error message #4645

@fehguy

Description

@fehguy
Description

This is a non-operational issue, but in the php client, the allowableValues are listed in a response error message when a model property is constrained by enum. In the current (2.2.2-SNAPSHOT) version, this value is not correct, which gives an incorrect error message to the caller

For example:

definitions:
  PaymentMethods:
    properties:
      cardTypes:
        type: string
        enum:
        - Visa
        - Discover
        - Amex

The generated code looks like this:

    public function listInvalidProperties()
    {
        $invalid_properties = [];
        $allowed_values = ["Visa", "Discover", "Amex"];
        if (!in_array($this->container['card_types'], $allowed_values)) {
            $invalid_properties[] = "invalid value for 'card_types', must be one of #{allowed_values}.";
        }

        return $invalid_properties;
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions