How could the following response schema properties be described in YAML?
"192.168.0.0/24": {
"members": {
"10:1f:74:b2:f6:a5": "192.168.0.2"
}
}
Both the network address key 192.168.0.0/24 and each of the member key(s) 10:1f:74:b2:f6:a5 are dynamic and must follow a specific regular expression pattern. I've found documentation on how to define regular expression patterns for the value, but there's no details on how to define a pattern for the key.
@satkunas this is not currently possible in OpenAPI's Schema Object.
In normal JSON Schema you could use patternProperties, but OpenAPI forbids it. If JSON Schema draft-06 or later were supported you could use propertyNames, but OpenAPI is based on draft-04
See also #1443 (alternate schema languages)
Hello! This is a very clear and helpful explanation, thank you!
I was curious if there are any plans to move to JSON schema draft-06 or later? Cheers.
@tylermauthe @satkunas OpenAPI 3.1 is moving to the latest JSON Schema draft (#1977), so this will be possible with regular JSON Schema features in that version. There's no way to do it in 3.0.x, and none can be added due to the patch release compatibility requirements.
Since it's fixed in 3.1 and can't be fixed in earlier versions, I'm going to go ahead and close this.
Most helpful comment
@tylermauthe @satkunas OpenAPI 3.1 is moving to the latest JSON Schema draft (#1977), so this will be possible with regular JSON Schema features in that version. There's no way to do it in 3.0.x, and none can be added due to the patch release compatibility requirements.
Since it's fixed in 3.1 and can't be fixed in earlier versions, I'm going to go ahead and close this.