Open autopp opened 5 years ago
👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
Thanks for the issue!
cc: Technical Committee @jebentier , @dkarlovi , @mandrean , @jfastnacht , @ybelenko , @renepardon
I think we can use #
(or other symbols) as delimiter instead of /
like below:
- * @DTA\Validator(name="Regex", options={"pattern":"/^[A-Z].*/"})
+ * @DTA\Validator(name="Regex", options={"pattern":"#^[A-Z].*#"})
As I've never used zend-expressive can't say for sure but if the annotation (@DTA\Validator
) is based on regex-functions like preg-match, the idea should work as expected. 💡
Note: For the similar reason, to avoid syntax error, the PHP generator replaces a media type */*
to *_/_*
. However, it can't be applicable in this issue as the approach breaks the regex strings.
If no one has further feedback, I'll start working on this issue.
Bug Report Checklist
Description
Generated zend-expressice stub contains syntax errors when pattern of property ends with
*
. The pattern is embedded into annotation and breaks the DocComment.This is also reproduced in the current sample. https://github.com/OpenAPITools/openapi-generator/blob/cefd29b6ffc5933ef66de994ecd60128f42f39b7/samples/server/openapi3/petstore/php-ze-ph/src/App/DTO/InlineObject3.php#L75
openapi-generator version
OpenAPI declaration file content or url
See: https://gist.github.com/autopp/472847da6c9de80450117a9cfecbc6d1#file-example-yml
Command line used for generation
Steps to reproduce
php -l /tmp/php-ze-ph/src/App/DTO/InlineObject.php
to check syntax of the generated model code.src/App/DTO/InlineObject.php
Related issues/PRs
N/A
Suggest a fix
Sorry, I have no idea. I don't know how to escape
*/
in a DocComment.