Skip to content

pattern must be compliant with ECMA 262 regex#4027

Merged
dunglas merged 7 commits into
api-platform:2.6from
stchr:fix_pattern_reged
Feb 6, 2021
Merged

pattern must be compliant with ECMA 262 regex#4027
dunglas merged 7 commits into
api-platform:2.6from
stchr:fix_pattern_reged

Conversation

@stchr

@stchr stchr commented Feb 5, 2021

Copy link
Copy Markdown
Contributor
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
Comment thread phpstan.neon.dist Outdated
…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

dunglas commented Feb 6, 2021

Copy link
Copy Markdown
Member

Thanks @stchr!

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

guilliamxavier commented Mar 31, 2021

Copy link
Copy Markdown
Contributor

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.

4 participants