Closed guillemcanal closed 2 years ago
Closing since stale - I'm doing a cleanup across the whole organization, to enable us to focus on the tickets that are still live and have interest. Please feel free to open a new issue if this still is important to you. :)
Hello guys,
So what are
patternProperties
you may ask ?Well it's part of the JSON Schema specification, and it allow one developper to describe objects with unpredictable keys.
Unlike
additionalProperties
, you can add constraints to your object member names (property name) using a regular expression.Like
properties
, you can associate eachpatternProperties
keys with a schema.Consider the following example:
Many of you (myself included) may consider this bad design, but when it come to legacy APIs, or poorly designed services, we still need a way to validate such a payload.
So here, the
foo
object contains keys that:^foo_[0-9]+$
pattern,integer
,Here is the Guzzle service schema that satisfy those requirements:
What do you guys think ?
Long story short, I already implemented this feature in guzzle3 (the company I'm working at have some trouble upgrading their PHP 5.3 ^^ ), but since the project is deprecated, I though it might be of some interest to port this feature in
guzzle-services
.