NelmioApiDocBundle/ModelDescriber
Christopher Davis 883d7b6c89
Apply enum from Choice Constraints to Items When Choice is Multiple (#1784)
* Apply `enum` from Choice Constraints to Items When Choice is Multiple

Otherwise JSON schema like this is generated:

```
"property": {
  "type": "array",
  "enum": ["one", "two", "three"],
  "items": {
    "type": "string"
  }
}
```

With this change, however, this schema is generated:

```
"property": {
  "type": "array",
  "items": {
    "type": "string",
    "enum": ["one", "two", "three"]
  }
}
```

A possible downside here is that the symfony constraint stuff happens
before types are figured out from PHPDoc. So it's _possible_ to end up
with something that won't validated. Take something like this:

```
/**
 * @Assert\Choice(multiple=true, choices={"..."})
 * @var string
 */
```

This would generate:

```
"property": {
  "type": "string",
  "items": {
    "enum": ["..."]
  }
}
```

* Fix CS

* cs

* more cs

* fix tests

Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
2021-02-19 09:41:32 +01:00
..
Annotations Apply enum from Choice Constraints to Items When Choice is Multiple (#1784) 2021-02-19 09:41:32 +01:00
ApplyOpenApiDiscriminatorTrait.php Don't Use ref in Discriminator mapping 2021-02-08 15:39:14 -06:00
BazingaHateoasModelDescriber.php OpenApi 3 Support (#1623) 2020-05-28 13:19:11 +02:00
FallbackObjectModelDescriber.php OpenApi 3 Support (#1623) 2020-05-28 13:19:11 +02:00
FormModelDescriber.php Merge branch '3.x' 2020-12-10 22:28:55 +01:00
JMSModelDescriber.php Fix the tests broken by zircote/swagger-php 2020-09-27 22:20:04 +02:00
ModelDescriberInterface.php OpenApi 3 Support (#1623) 2020-05-28 13:19:11 +02:00
ObjectModelDescriber.php Fix CS 2021-02-01 09:50:15 -06:00