Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pattern must be compliant with ECMA 262 regex #4027

Merged
merged 7 commits into from Feb 6, 2021

Conversation

stchr
Copy link
Contributor

@stchr stchr commented Feb 5, 2021

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tickets fixes #4022
License MIT
Doc PR api-platform/docs#...

https://swagger.io/docs/specification/data-models/data-types/#pattern uses ECMA 262 regex syntax, so use getHtmlPattern() to get valid expression.

@stchr stchr marked this pull request as ready for review February 5, 2021 22:20
@stchr stchr changed the title Use getHtmlPattern to be compliant with ECMA 262 pattern must be compliant with ECMA 262 regex Feb 5, 2021
…pertySchemaRegexRestriction.php

Co-authored-by: Kévin Dunglas <dunglas@gmail.com>
@dunglas dunglas merged commit 8a16c9d into api-platform:2.6 Feb 6, 2021
@dunglas
Copy link
Member

dunglas commented Feb 6, 2021

Thanks @stchr!

cacahouwete pushed a commit to cacahouwete/core that referenced this pull request Feb 8, 2021
@guilliamxavier
Copy link
Contributor

guilliamxavier commented Mar 31, 2021

Thanks for the fix but it is incomplete: for @Assert\Regex(pattern="/^dummy$/") (anchored) we should generate a schema with "pattern": "^dummy$" (anchored), not "dummy".

Update: see #4176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants