-
-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
1 parent
ceda09f
commit 883d7b6
Showing
4 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters