Skip to content

Commit 72da3b2

Browse files
authored
fix slash in php gneerator doc/config (#16462)
1 parent 5954dae commit 72da3b2

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/BackSlashLambda.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
public class BackSlashLambda implements Mustache.Lambda {
4141
@Override
4242
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
43-
writer.write(fragment.execute().replace("/", "\\"));
43+
writer.write(fragment.execute()
44+
.replace("/", "\\"));
4445
}
4546
}

modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/ForwardSlashLambda.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
public class ForwardSlashLambda implements Mustache.Lambda {
4141
@Override
4242
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
43-
writer.write(fragment.execute().replace("\\", "/"));
43+
writer.write(fragment.execute()
44+
.replace("\\/", "/")
45+
.replace("\\", "/")
46+
.replace("//", "/"));
4447
}
4548
}

modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,17 @@ No model defined in this package
196196
{{#authMethods}}
197197
{{#isBasicBasic}}
198198
### Security schema `{{name}}`
199-
> Important! To make Basic authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{authSrcPath}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\BasicAuthenticator](./src/Auth/BasicAuthenticator.php) class.
199+
> Important! To make Basic authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{#lambda.forwardslash}}{{authSrcPath}}{{/lambda.forwardslash}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\BasicAuthenticator](./src/Auth/BasicAuthenticator.php) class.
200200

201201
{{/isBasicBasic}}
202202
{{#isApiKey}}
203203
### Security schema `{{name}}`
204-
> Important! To make ApiKey authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{authSrcPath}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\ApiKeyAuthenticator](./src/Auth/ApiKeyAuthenticator.php) class.
204+
> Important! To make ApiKey authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{#lambda.forwardslash}}{{authSrcPath}}{{/lambda.forwardslash}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\ApiKeyAuthenticator](./src/Auth/ApiKeyAuthenticator.php) class.
205205

206206
{{/isApiKey}}
207207
{{#isOAuth}}
208208
### Security schema `{{name}}`
209-
> Important! To make OAuth authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{authSrcPath}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\OAuthAuthenticator](./src/Auth/OAuthAuthenticator.php) class.
209+
> Important! To make OAuth authentication work you need to extend [\{{authPackage}}\{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}]({{#lambda.forwardslash}}{{authSrcPath}}{{/lambda.forwardslash}}/{{abstractNamePrefix}}Authenticator{{abstractNameSuffix}}.php) class by [\{{authPackage}}\OAuthAuthenticator](./src/Auth/OAuthAuthenticator.php) class.
210210

211211
Scope list:
212212
{{#scopes}}

modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="./vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" beStrictAboutTestsThatDoNotTestAnything="false" stopOnFailure="false">
33
<coverage processUncoveredFiles="true">
44
<include>
5-
<directory suffix=".php">{{apiSrcPath}}</directory>
5+
<directory suffix=".php">{{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}}</directory>
66
<file>./{{srcBasePath}}/BaseModel.php</file>
7-
<directory suffix=".php">{{modelSrcPath}}</directory>
7+
<directory suffix=".php">{{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}}</directory>
88
</include>
99
</coverage>
1010
<testsuites>

modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
1010
<coverage processUncoveredFiles="true">
1111
<include>
12-
<directory suffix=".php">{{apiSrcPath}}</directory>
13-
<directory suffix=".php">{{modelSrcPath}}</directory>
14-
<directory suffix=".php">{{controllerSrcPath}}</directory>
12+
<directory suffix=".php">{{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}}</directory>
13+
<directory suffix=".php">{{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}}</directory>
14+
<directory suffix=".php">{{#lambda.forwardslash}}{{controllerSrcPath}}{{/lambda.forwardslash}}</directory>
1515
</include>
1616
</coverage>
1717
<testsuites>

modules/openapi-generator/src/main/resources/php/phpunit.xml.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
33
<coverage processUncoveredFiles="true">
44
<include>
5-
<directory suffix=".php">{{apiSrcPath}}</directory>
6-
<directory suffix=".php">{{modelSrcPath}}</directory>
5+
<directory suffix=".php">{{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}}</directory>
6+
<directory suffix=".php">{{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}}</directory>
77
</include>
88
</coverage>
99
<testsuites>

0 commit comments

Comments
 (0)