fix slash in php gneerator doc/config (#16462)

This commit is contained in:
William Cheng 2023-08-31 15:22:38 +08:00 committed by GitHub
parent 5954daea18
commit 72da3b2c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 12 deletions

View File

@ -40,6 +40,7 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
public class BackSlashLambda implements Mustache.Lambda { public class BackSlashLambda implements Mustache.Lambda {
@Override @Override
public void execute(Template.Fragment fragment, Writer writer) throws IOException { public void execute(Template.Fragment fragment, Writer writer) throws IOException {
writer.write(fragment.execute().replace("/", "\\")); writer.write(fragment.execute()
.replace("/", "\\"));
} }
} }

View File

@ -40,6 +40,9 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
public class ForwardSlashLambda implements Mustache.Lambda { public class ForwardSlashLambda implements Mustache.Lambda {
@Override @Override
public void execute(Template.Fragment fragment, Writer writer) throws IOException { public void execute(Template.Fragment fragment, Writer writer) throws IOException {
writer.write(fragment.execute().replace("\\", "/")); writer.write(fragment.execute()
.replace("\\/", "/")
.replace("\\", "/")
.replace("//", "/"));
} }
} }

View File

@ -196,17 +196,17 @@ No model defined in this package
{{#authMethods}} {{#authMethods}}
{{#isBasicBasic}} {{#isBasicBasic}}
### Security schema `{{name}}` ### Security schema `{{name}}`
> 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. > 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.
{{/isBasicBasic}} {{/isBasicBasic}}
{{#isApiKey}} {{#isApiKey}}
### Security schema `{{name}}` ### Security schema `{{name}}`
> 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. > 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.
{{/isApiKey}} {{/isApiKey}}
{{#isOAuth}} {{#isOAuth}}
### Security schema `{{name}}` ### Security schema `{{name}}`
> 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. > 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.
Scope list: Scope list:
{{#scopes}} {{#scopes}}

View File

@ -2,9 +2,9 @@
<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"> <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">
<coverage processUncoveredFiles="true"> <coverage processUncoveredFiles="true">
<include> <include>
<directory suffix=".php">{{apiSrcPath}}</directory> <directory suffix=".php">{{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}}</directory>
<file>./{{srcBasePath}}/BaseModel.php</file> <file>./{{srcBasePath}}/BaseModel.php</file>
<directory suffix=".php">{{modelSrcPath}}</directory> <directory suffix=".php">{{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}}</directory>
</include> </include>
</coverage> </coverage>
<testsuites> <testsuites>

View File

@ -9,9 +9,9 @@
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true"> <coverage processUncoveredFiles="true">
<include> <include>
<directory suffix=".php">{{apiSrcPath}}</directory> <directory suffix=".php">{{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}}</directory>
<directory suffix=".php">{{modelSrcPath}}</directory> <directory suffix=".php">{{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}}</directory>
<directory suffix=".php">{{controllerSrcPath}}</directory> <directory suffix=".php">{{#lambda.forwardslash}}{{controllerSrcPath}}{{/lambda.forwardslash}}</directory>
</include> </include>
</coverage> </coverage>
<testsuites> <testsuites>

View File

@ -2,8 +2,8 @@
<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"> <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">
<coverage processUncoveredFiles="true"> <coverage processUncoveredFiles="true">
<include> <include>
<directory suffix=".php">{{apiSrcPath}}</directory> <directory suffix=".php">{{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}}</directory>
<directory suffix=".php">{{modelSrcPath}}</directory> <directory suffix=".php">{{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}}</directory>
</include> </include>
</coverage> </coverage>
<testsuites> <testsuites>