Skip to content

[PHP]Generated lumen code can contain dots in routes #985

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o

for (CodegenOperation op : operations) {
op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT);
// check to see if the path contains ".", which is not supported by Lumen
if (op.path != null && op.path.contains(".")) {
throw new IllegalArgumentException("'.' (dot) is not supported by PHP Lumen.");
}
}

// sort the endpoints in ascending to avoid the route priority issure.
Expand Down
5 changes: 5 additions & 0 deletions modules/openapi-generator/src/main/resources/lumen/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ This example uses the [Lumen Framework](http://lumen.laravel.com/). To see how

Using `composer install` to install the framework and dependencies via [Composer](http://getcomposer.org/).

### Running the generated server stub

```bash
php -S localhost:8080 public/index.php
```
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

/**
* OpenAPI Petstore ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end --
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] ' \" =end -- \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand All @@ -29,7 +29,7 @@ public function __construct()
/**
* Operation testCodeInjectEndRnNR
*
* To test code injection ' \" =end -- \\r\\n \\n \\r.
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r.
*
*
* @return Http response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

/**
* OpenAPI Petstore ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end --
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] ' \" =end -- \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* OpenAPI Petstore &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @version 1.0.0 &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @version 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*/

$app->get('/', function () use ($app) {
Expand All @@ -23,9 +23,9 @@

/**
* put testCodeInjectEndRnNR
* Summary: To test code injection &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* Notes:
* Summary: To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* Notes: To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r

*/
$app->put('/fake', 'FakeApi@testCodeInjectEndRnNR');
$app->put('/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r/fake', 'FakeApi@testCodeInjectEndRnNR');

5 changes: 5 additions & 0 deletions samples/server/petstore-security-test/lumen/lib/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ This example uses the [Lumen Framework](http://lumen.laravel.com/). To see how

Using `composer install` to install the framework and dependencies via [Composer](http://getcomposer.org/).

### Running the generated server stub

```bash
php -S localhost:8080 public/index.php
```
5 changes: 5 additions & 0 deletions samples/server/petstore/php-lumen/lib/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ This example uses the [Lumen Framework](http://lumen.laravel.com/). To see how

Using `composer install` to install the framework and dependencies via [Composer](http://getcomposer.org/).

### Running the generated server stub

```bash
php -S localhost:8080 public/index.php
```