You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the section of ECMA262 linked to describes the regular expression literal i.e. / RegularExpressionBody / RegularExpressionFlags so it is unclear whether "valid regular expression" means the body or the literal.
There are no example usages of regex patterns in the OAS 3.0.2 document that I can see. However, another example of patterns used in OpenAPI that I have found does not include the / characters around the regex e.g.:
I think it is unclear from the specification (either OAS or JSON schema validation) whether the pattern field is expected to be a complete ECMA 262 regular expression literal, including the / characters and optionally including flags, or whether it is saying that only a regular expression body is expected.
Tooling behaviour seems a little inconsistent on this too, so I think a clarification would be useful to help tooling developers know which of these 3 types of pattern values should be supported:
@ricellis it is definitely 1. myregexbody. The correct reference is ECMA 262 Annex A.7, "Regular Expressions", although given that that section is informative rather than normative there might be some complications on exactly how to cite that. Referencing RegularExpressionBody for clarity would probably be a good idea.
This should really be filed on the JSON Schema spec repo.
Thanks @handrews, I've opened json-schema-org/json-schema-spec#774 for a clarification in the JSON Schema validation spec. I guess there may still be work here to update the link in the OAS spec or also cite that only a RegularExpressionBody is expected.
As per that clarification; the correct ECMA 262 section to link is 15.10.1 - I've opened PR #1987 to correct the OpenAPI spec link to also point to that section.
JSON Schema 2019-09 (formerly known as "draft-08") has been published, and OAS PR #1977 is about updating the Schema Object to be compatible with it in OAS 3.1. I think the PR mentioned above is still useful for OAS 3.0, as the JSON Schema draft there will not be changing.
Activity
handrews commentedon Aug 7, 2019
@ricellis it is definitely 1.
myregexbody. The correct reference is ECMA 262 Annex A.7, "Regular Expressions", although given that that section is informative rather than normative there might be some complications on exactly how to cite that. ReferencingRegularExpressionBodyfor clarity would probably be a good idea.This should really be filed on the JSON Schema spec repo.
I'll try to remember to clarify that i
ricellis commentedon Aug 8, 2019
Thanks @handrews, I've opened json-schema-org/json-schema-spec#774 for a clarification in the JSON Schema validation spec. I guess there may still be work here to update the link in the OAS spec or also cite that only a
RegularExpressionBodyis expected.ricellis commentedon Aug 16, 2019
Note that the JSON Schema spec has been updated (targetting draft-08) to clarify this via json-schema-org/json-schema-spec#775.
As per that clarification; the correct ECMA 262 section to link is 15.10.1 - I've opened PR #1987 to correct the OpenAPI spec link to also point to that section.
handrews commentedon Sep 20, 2019
JSON Schema 2019-09 (formerly known as "draft-08") has been published, and OAS PR #1977 is about updating the Schema Object to be compatible with it in OAS 3.1. I think the PR mentioned above is still useful for OAS 3.0, as the JSON Schema draft there will not be changing.
philsturgeon commentedon Jan 9, 2020
This was fixed in #1977 so we can close this.
akimking-86 commentedon Jul 15, 2025
ok