From ec6381295a23645c275f12e5853486b04d650827 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 12 Jul 2023 13:22:05 +0800 Subject: [PATCH] Update php options for better customization of composer.json (#16078) * update php options * update tests --- docs/generators/php-dt.md | 5 ++++ docs/generators/php-laravel.md | 5 ++++ docs/generators/php-lumen.md | 5 ++++ docs/generators/php-mezzio-ph.md | 5 ++++ docs/generators/php-slim-deprecated.md | 5 ++++ docs/generators/php-slim4.md | 5 ++++ docs/generators/php-symfony.md | 5 ++++ docs/generators/php.md | 6 +++- .../codegen/CodegenConstants.java | 2 ++ .../codegen/languages/AbstractPhpCodegen.java | 28 ++++++++++++------- .../php-dt-modern/composer.json.mustache | 15 +++++++++- .../resources/php-dt/composer.json.mustache | 15 +++++++++- .../resources/php-laravel/composer.mustache | 14 +++++++++- .../resources/php-lumen/composer.mustache | 8 +++--- .../composer.json.mustache | 15 +++++++++- .../php-mezzio-ph/composer.json.mustache | 15 +++++++++- .../php-slim4-server/composer.mustache | 14 ++++++++++ .../resources/php-symfony/composer.mustache | 13 ++++++--- .../src/main/resources/php/composer.mustache | 16 +++++------ .../lumen/PhpLumenServerOptionsTest.java | 4 +++ .../options/PhpClientOptionsProvider.java | 10 +++++++ .../PhpLumenServerOptionsProvider.java | 10 +++++++ .../PhpSlim4ServerOptionsProvider.java | 10 +++++++ .../options/PhpSlimServerOptionsProvider.java | 10 +++++++ .../codegen/php/PhpClientOptionsTest.java | 5 ++++ .../slim4/PhpSlim4ServerOptionsTest.java | 5 ++++ .../petstore/php-dt-modern/composer.json | 15 +++++++++- samples/client/petstore/php-dt/composer.json | 13 +++++++++ .../php/OpenAPIClient-php/composer.json | 2 +- .../petstore/php-laravel/lib/composer.json | 14 +++++++++- .../petstore/php-lumen/lib/composer.json | 4 +-- .../php-mezzio-ph-modern/composer.json | 13 +++++++++ .../petstore/php-mezzio-ph/composer.json | 15 +++++++++- .../server/petstore/php-slim4/composer.json | 14 ++++++++++ .../SymfonyBundle-php/composer.json | 6 ++-- 35 files changed, 305 insertions(+), 41 deletions(-) diff --git a/docs/generators/php-dt.md b/docs/generators/php-dt.md index ba0c71e0000..9a16b14c8a7 100644 --- a/docs/generators/php-dt.md +++ b/docs/generators/php-dt.md @@ -20,12 +20,17 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |modern|use modern language features (generated code will require PHP 8.0)| |false| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| diff --git a/docs/generators/php-laravel.md b/docs/generators/php-laravel.md index 3a973fb9041..4a32628fbe5 100644 --- a/docs/generators/php-laravel.md +++ b/docs/generators/php-laravel.md @@ -20,12 +20,17 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-lumen.md b/docs/generators/php-lumen.md index f90bf8d416f..9b75a15eac8 100644 --- a/docs/generators/php-lumen.md +++ b/docs/generators/php-lumen.md @@ -20,12 +20,17 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-mezzio-ph.md b/docs/generators/php-mezzio-ph.md index dbae6387226..ba88d42aa90 100644 --- a/docs/generators/php-mezzio-ph.md +++ b/docs/generators/php-mezzio-ph.md @@ -20,12 +20,17 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |modern|use modern language features (generated code will require PHP 8.0)| |false| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| diff --git a/docs/generators/php-slim-deprecated.md b/docs/generators/php-slim-deprecated.md index 5ac9535a595..e2527f1ce12 100644 --- a/docs/generators/php-slim-deprecated.md +++ b/docs/generators/php-slim-deprecated.md @@ -20,12 +20,17 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-slim4.md b/docs/generators/php-slim4.md index 5605d63ba01..c6010777ef1 100644 --- a/docs/generators/php-slim4.md +++ b/docs/generators/php-slim4.md @@ -20,12 +20,17 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-symfony.md b/docs/generators/php-symfony.md index 23f23ed74cf..f502ec457bc 100644 --- a/docs/generators/php-symfony.md +++ b/docs/generators/php-symfony.md @@ -20,17 +20,22 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |bundleAlias|The alias of the Symfony bundle. The template uses {{aliasName}}| |null| |bundleName|The name of the Symfony bundle. The template uses {{bundleName}}| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| |composerProjectName|The project name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. petstore-client| |null| |composerVendorName|The vendor name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. yaypets| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |phpLegacySupport|Should the generated code be compatible with PHP 5.x?| |true| diff --git a/docs/generators/php.md b/docs/generators/php.md index 93dc37ad0d8..da5d62a51fd 100644 --- a/docs/generators/php.md +++ b/docs/generators/php.md @@ -20,14 +20,18 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| +|artifactUrl|artifact URL in generated pom.xml| |null| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| -|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`)| |null| +|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null| +|developerOrganization|developer organization in generated pom.xml| |null| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |null| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| |hideGenerationTimestamp|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|licenseName|The name of the license| |null| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 15594088299..b5cd594ced6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -176,6 +176,8 @@ public class CodegenConstants { public static final String PACKAGE_AUTHORS_URL_DESC = "Specifies Authors URL property in the PHP composer.json file."; public static final String PACKAGE_COPYRIGHT = "packageCopyright"; public static final String PACKAGE_COPYRIGHT_DESC = "Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file."; + public static final String COMPOSER_PACKAGE_NAME = "composerPackageName"; + public static final String COMPOSER_PACKAGE_NAME_DESC = "The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`)."; public static final String POD_VERSION = "podVersion"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java index 23c7c4d03f4..ebe0d0cf59b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java @@ -155,6 +155,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg cliOptions.add(new CliOption(CodegenConstants.LICENSE_NAME, CodegenConstants.LICENSE_NAME_DESC)); cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION, CodegenConstants.DEVELOPER_ORGANIZATION_DESC)); cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION_URL, CodegenConstants.DEVELOPER_ORGANIZATION_URL_DESC)); + cliOptions.add(new CliOption(CodegenConstants.COMPOSER_PACKAGE_NAME, CodegenConstants.COMPOSER_PACKAGE_NAME_DESC)); } @Override @@ -200,7 +201,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg } additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); - // {{artifactVersion}} + // {{artifactVersion}} if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION)) { this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION)); } else { @@ -294,9 +295,9 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg // Trim prefix file separators from package path String packagePath = StringUtils.removeStart( - // Replace period, backslash, forward slash with file separator in package name - modifiedPackageName.replaceAll("[\\.\\\\/]", Matcher.quoteReplacement("/")), - File.separator + // Replace period, backslash, forward slash with file separator in package name + modifiedPackageName.replaceAll("[\\.\\\\/]", Matcher.quoteReplacement("/")), + File.separator ); // Trim trailing file separators from the overall path @@ -417,6 +418,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg return toModelName(type); } + public String getInvokerPackage() { + return invokerPackage; + } + public void setInvokerPackage(String invokerPackage) { this.invokerPackage = invokerPackage; } @@ -609,6 +614,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg /** * Return the default value of the property + * * @param p OpenAPI property object * @return string presentation of the default value of the property */ @@ -726,7 +732,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg return "EMPTY"; } - if(name.trim().length() == 0) { + if (name.trim().length() == 0) { return "SPACE_" + name.length(); } @@ -806,7 +812,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg } // If the string contains only "trim-able" characters, don't trim it - if(input.trim().length() == 0) { + if (input.trim().length() == 0) { return input; } @@ -876,9 +882,9 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg public String getComposerPackageName() { String packageName = this.getGitUserId() + "/" + this.getGitRepoId(); if ( - packageName.contentEquals("/") - || packageName.contentEquals("null/null") - || !Pattern.matches("^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$", packageName) + packageName.contentEquals("/") + || packageName.contentEquals("null/null") + || !Pattern.matches("^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$", packageName) ) { return ""; } @@ -892,5 +898,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg } @Override - public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.PHP; } + public GeneratorLanguage generatorLanguage() { + return GeneratorLanguage.PHP; + } } diff --git a/modules/openapi-generator/src/main/resources/php-dt-modern/composer.json.mustache b/modules/openapi-generator/src/main/resources/php-dt-modern/composer.json.mustache index 2ca459e6524..d45f0e24a19 100644 --- a/modules/openapi-generator/src/main/resources/php-dt-modern/composer.json.mustache +++ b/modules/openapi-generator/src/main/resources/php-dt-modern/composer.json.mustache @@ -1,9 +1,22 @@ { "name": "{{#lambda.lowercase}}{{gitUserId}}/{{gitRepoId}}{{/lambda.lowercase}}", "description": "{{description}}", - "license": "unlicense", "version": "{{artifactVersion}}", "type": "library", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", + "authors": [ + { + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" + } + ], "require": { "php": "^8.0", "articus/data-transfer": "^0.5", diff --git a/modules/openapi-generator/src/main/resources/php-dt/composer.json.mustache b/modules/openapi-generator/src/main/resources/php-dt/composer.json.mustache index a0d5ae7066c..2ce529f891a 100644 --- a/modules/openapi-generator/src/main/resources/php-dt/composer.json.mustache +++ b/modules/openapi-generator/src/main/resources/php-dt/composer.json.mustache @@ -1,7 +1,20 @@ { "name": "{{#lambda.lowercase}}{{gitUserId}}/{{gitRepoId}}{{/lambda.lowercase}}", "description": "{{description}}", - "license": "unlicense", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", + "authors": [ + { + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" + } + ], "version": "{{artifactVersion}}", "type": "library", "require": { diff --git a/modules/openapi-generator/src/main/resources/php-laravel/composer.mustache b/modules/openapi-generator/src/main/resources/php-laravel/composer.mustache index 1893d78f062..5bb93492cd7 100644 --- a/modules/openapi-generator/src/main/resources/php-laravel/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-laravel/composer.mustache @@ -5,7 +5,19 @@ {{#artifactVersion}} "version": "{{.}}", {{/artifactVersion}} - "license": "MIT", + "keywords": [ + "openapi", + "php", + "api" + ], + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", + "authors": [ + { + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" + } + ], "type": "project", "require": { "php": "^7.2.5", diff --git a/modules/openapi-generator/src/main/resources/php-lumen/composer.mustache b/modules/openapi-generator/src/main/resources/php-lumen/composer.mustache index 2f6e96b0815..e6835f69222 100644 --- a/modules/openapi-generator/src/main/resources/php-lumen/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-lumen/composer.mustache @@ -14,12 +14,12 @@ "sdk", "api" ], - "homepage": "http://openapi-generator.tech", - "license": "unlicense", + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", "authors": [ { - "name": "OpenAPI-Generator contributors", - "homepage": "https://openapi-generator.tech" + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" } ], "type": "project", diff --git a/modules/openapi-generator/src/main/resources/php-mezzio-ph-modern/composer.json.mustache b/modules/openapi-generator/src/main/resources/php-mezzio-ph-modern/composer.json.mustache index 787d5fb97f2..aff61e1f25c 100644 --- a/modules/openapi-generator/src/main/resources/php-mezzio-ph-modern/composer.json.mustache +++ b/modules/openapi-generator/src/main/resources/php-mezzio-ph-modern/composer.json.mustache @@ -1,7 +1,20 @@ { "name": "{{#lambda.lowercase}}{{gitUserId}}/{{gitRepoId}}{{/lambda.lowercase}}", "description": "{{description}}", - "license": "unlicense", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", + "authors": [ + { + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" + } + ], "version": "{{artifactVersion}}", "type": "project", "require": { diff --git a/modules/openapi-generator/src/main/resources/php-mezzio-ph/composer.json.mustache b/modules/openapi-generator/src/main/resources/php-mezzio-ph/composer.json.mustache index de46c4b20ea..b7c25a283ce 100644 --- a/modules/openapi-generator/src/main/resources/php-mezzio-ph/composer.json.mustache +++ b/modules/openapi-generator/src/main/resources/php-mezzio-ph/composer.json.mustache @@ -1,9 +1,22 @@ { "name": "{{#lambda.lowercase}}{{gitUserId}}/{{gitRepoId}}{{/lambda.lowercase}}", "description": "{{description}}", - "license": "unlicense", "version": "{{artifactVersion}}", "type": "project", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", + "authors": [ + { + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" + } + ], "require": { "php": "^7.3 || ^8.0", "ext-yaml": "^2.0", diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache index f6e55be7860..c2825b4f8d0 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache @@ -7,6 +7,20 @@ "no-api": true } ], + "description": "{{description}}", + "keywords": [ + "openapi", + "php", + "api" + ], + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", + "authors": [ + { + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" + } + ], "require": { "php": "^7.4 || ^8.0", "dyorg/slim-token-authentication": "dev-slim4", diff --git a/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache b/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache index e4ecd72994d..2e66acfed8d 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/composer.mustache @@ -1,5 +1,10 @@ { + {{#composerPackageName}} + "name": "{{{.}}}", + {{/composerPackageName}} + {{^composerPackageName}} "name": "{{gitUserId}}/{{gitRepoId}}", + {{/composerPackageName}} {{#artifactVersion}} "version": "{{.}}", {{/artifactVersion}} @@ -10,12 +15,12 @@ "sdk", "api" ], - "homepage": "https://github.com/openapitools/openapi-generator", - "license": "unlicense", + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", "authors": [ { - "name": "openapi-generator contributors", - "homepage": "https://github.com/openapitools/openapi-generator" + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" } ], "require": { diff --git a/modules/openapi-generator/src/main/resources/php/composer.mustache b/modules/openapi-generator/src/main/resources/php/composer.mustache index e265c15c05a..121ba6a3368 100644 --- a/modules/openapi-generator/src/main/resources/php/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php/composer.mustache @@ -1,9 +1,9 @@ { {{#composerPackageName}} - "name": "{{.}}", + "name": "{{{.}}}", {{/composerPackageName}} {{#artifactVersion}} - "version": "{{.}}", + "version": "{{{.}}}", {{/artifactVersion}} "description": "{{{appDescription}}}", "keywords": [ @@ -15,12 +15,12 @@ "rest", "api" ], - "homepage": "{{artifactUrl}}", - "license": "{{licenseName}}", + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", "authors": [ { - "name": "{{developerOrganization}}", - "homepage": "{{developerOrganizationUrl}}" + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}" } ], "require": { @@ -36,9 +36,9 @@ "friendsofphp/php-cs-fixer": "^3.5" }, "autoload": { - "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } + "psr-4": { "{{{escapedInvokerPackage}}}\\" : "{{{srcBasePath}}}/" } }, "autoload-dev": { - "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } + "psr-4": { "{{{escapedInvokerPackage}}}\\Test\\" : "{{{testBasePath}}}/" } } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java index 73af635bb02..c8b4cbb76e1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java @@ -49,5 +49,9 @@ public class PhpLumenServerOptionsTest extends AbstractOptionsTest { verify(clientCodegen).setSrcBasePath(PhpLumenServerOptionsProvider.SRC_BASE_PATH_VALUE); verify(clientCodegen).setArtifactVersion(PhpLumenServerOptionsProvider.ARTIFACT_VERSION_VALUE); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(PhpLumenServerOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); + verify(clientCodegen).setLicenseName(PhpLumenServerOptionsProvider.LICENSE_VALUE); + verify(clientCodegen).setDeveloperOrganizationUrl(PhpLumenServerOptionsProvider.DEVELOPER_ORGANIZATION_URL_VALUE); + verify(clientCodegen).setArtifactUrl(PhpLumenServerOptionsProvider.ARTIFACTURL_VALUE); + verify(clientCodegen).setDeveloperOrganization(PhpLumenServerOptionsProvider.DEVELOPER_ORGANIZATION_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java index 21ce7e748c8..2ef78d72167 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java @@ -37,6 +37,11 @@ public class PhpClientOptionsProvider implements OptionsProvider { public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false"; + public static final String LICENSE_VALUE = "mit"; + public static final String DEVELOPER_ORGANIZATION_URL_VALUE = "http://github.com/openapitools/openapi-generator"; + public static final String ARTIFACTURL_VALUE = "https://anotherUrl.com"; + public static final String DEVELOPER_ORGANIZATION_VALUE = "openapi generator contributors"; + public static final String COMPOSER_PACKAGE_NAME_VALUE = "package/name"; @Override public String getLanguage() { @@ -62,6 +67,11 @@ public class PhpClientOptionsProvider implements OptionsProvider { .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") .put(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, ENUM_UNKNOWN_DEFAULT_CASE_VALUE) + .put(CodegenConstants.LICENSE_NAME, LICENSE_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, DEVELOPER_ORGANIZATION_URL_VALUE) + .put(CodegenConstants.ARTIFACT_URL, ARTIFACTURL_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION, DEVELOPER_ORGANIZATION_VALUE) + .put(CodegenConstants.COMPOSER_PACKAGE_NAME, COMPOSER_PACKAGE_NAME_VALUE) .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java index 3c0779cf5f8..ee795a03873 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java @@ -37,6 +37,11 @@ public class PhpLumenServerOptionsProvider implements OptionsProvider { public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false"; + public static final String LICENSE_VALUE = "mit"; + public static final String DEVELOPER_ORGANIZATION_URL_VALUE = "http://github.com/openapitools/openapi-generator"; + public static final String ARTIFACTURL_VALUE = "https://anotherUrl.com"; + public static final String DEVELOPER_ORGANIZATION_VALUE = "openapi generator contributors"; + public static final String COMPOSER_PACKAGE_NAME_VALUE = "package/name"; @Override public String getLanguage() { @@ -61,6 +66,11 @@ public class PhpLumenServerOptionsProvider implements OptionsProvider { .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") .put(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, ENUM_UNKNOWN_DEFAULT_CASE_VALUE) + .put(CodegenConstants.LICENSE_NAME, LICENSE_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, DEVELOPER_ORGANIZATION_URL_VALUE) + .put(CodegenConstants.ARTIFACT_URL, ARTIFACTURL_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION, DEVELOPER_ORGANIZATION_VALUE) + .put(CodegenConstants.COMPOSER_PACKAGE_NAME, COMPOSER_PACKAGE_NAME_VALUE) .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java index 2e6a8f6ee66..7ebaece2aae 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java @@ -39,6 +39,11 @@ public class PhpSlim4ServerOptionsProvider implements OptionsProvider { public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; public static final String PSR7_IMPLEMENTATION_VALUE = "zend-diactoros"; public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false"; + public static final String LICENSE_VALUE = "mit"; + public static final String DEVELOPER_ORGANIZATION_URL_VALUE = "http://github.com/openapitools/openapi-generator"; + public static final String ARTIFACTURL_VALUE = "https://anotherUrl.com"; + public static final String DEVELOPER_ORGANIZATION_VALUE = "openapi generator contributors"; + public static final String COMPOSER_PACKAGE_NAME_VALUE = "package/name"; @Override public String getLanguage() { @@ -64,6 +69,11 @@ public class PhpSlim4ServerOptionsProvider implements OptionsProvider { .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") .put(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, ENUM_UNKNOWN_DEFAULT_CASE_VALUE) + .put(CodegenConstants.LICENSE_NAME, LICENSE_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, DEVELOPER_ORGANIZATION_URL_VALUE) + .put(CodegenConstants.ARTIFACT_URL, ARTIFACTURL_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION, DEVELOPER_ORGANIZATION_VALUE) + .put(CodegenConstants.COMPOSER_PACKAGE_NAME, COMPOSER_PACKAGE_NAME_VALUE) .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java index be1d495713f..9aab3096c1d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java @@ -37,6 +37,11 @@ public class PhpSlimServerOptionsProvider implements OptionsProvider { public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false"; + public static final String LICENSE_VALUE = "mit"; + public static final String DEVELOPER_ORGANIZATION_URL_VALUE = "http://github.com/openapitools/openapi-generator"; + public static final String ARTIFACTURL_VALUE = "https://anotherUrl.com"; + public static final String DEVELOPER_ORGANIZATION_VALUE = "openapi generator contributors"; + public static final String COMPOSER_PACKAGE_NAME_VALUE = "package/name"; @Override public String getLanguage() { @@ -61,6 +66,11 @@ public class PhpSlimServerOptionsProvider implements OptionsProvider { .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") .put(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, ENUM_UNKNOWN_DEFAULT_CASE_VALUE) + .put(CodegenConstants.LICENSE_NAME, LICENSE_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, DEVELOPER_ORGANIZATION_URL_VALUE) + .put(CodegenConstants.ARTIFACT_URL, ARTIFACTURL_VALUE) + .put(CodegenConstants.DEVELOPER_ORGANIZATION, DEVELOPER_ORGANIZATION_VALUE) + .put(CodegenConstants.COMPOSER_PACKAGE_NAME, COMPOSER_PACKAGE_NAME_VALUE) .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java index 0432dec115e..5a849757b5f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java @@ -21,6 +21,7 @@ import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PhpClientCodegen; import org.openapitools.codegen.options.PhpClientOptionsProvider; +import org.openapitools.codegen.options.PhpLumenServerOptionsProvider; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -49,5 +50,9 @@ public class PhpClientOptionsTest extends AbstractOptionsTest { verify(clientCodegen).setSrcBasePath(PhpClientOptionsProvider.SRC_BASE_PATH_VALUE); verify(clientCodegen).setArtifactVersion(PhpClientOptionsProvider.ARTIFACT_VERSION_VALUE); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(PhpClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); + verify(clientCodegen).setLicenseName(PhpClientOptionsProvider.LICENSE_VALUE); + verify(clientCodegen).setDeveloperOrganizationUrl(PhpClientOptionsProvider.DEVELOPER_ORGANIZATION_URL_VALUE); + verify(clientCodegen).setArtifactUrl(PhpClientOptionsProvider.ARTIFACTURL_VALUE); + verify(clientCodegen).setDeveloperOrganization(PhpClientOptionsProvider.DEVELOPER_ORGANIZATION_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java index b9c76e6b641..906523d0771 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java @@ -20,6 +20,7 @@ package org.openapitools.codegen.slim4; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PhpSlim4ServerCodegen; +import org.openapitools.codegen.options.PhpLumenServerOptionsProvider; import org.openapitools.codegen.options.PhpSlim4ServerOptionsProvider; import static org.mockito.Mockito.mock; @@ -50,6 +51,10 @@ public class PhpSlim4ServerOptionsTest extends AbstractOptionsTest { verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpSlim4ServerOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setPsr7Implementation(PhpSlim4ServerOptionsProvider.PSR7_IMPLEMENTATION_VALUE); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(PhpSlim4ServerOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); + verify(clientCodegen).setLicenseName(PhpSlim4ServerOptionsProvider.LICENSE_VALUE); + verify(clientCodegen).setDeveloperOrganizationUrl(PhpSlim4ServerOptionsProvider.DEVELOPER_ORGANIZATION_URL_VALUE); + verify(clientCodegen).setArtifactUrl(PhpLumenServerOptionsProvider.ARTIFACTURL_VALUE); + verify(clientCodegen).setDeveloperOrganization(PhpSlim4ServerOptionsProvider.DEVELOPER_ORGANIZATION_VALUE); } } diff --git a/samples/client/petstore/php-dt-modern/composer.json b/samples/client/petstore/php-dt-modern/composer.json index b039e9df0c1..e6df7330dc6 100644 --- a/samples/client/petstore/php-dt-modern/composer.json +++ b/samples/client/petstore/php-dt-modern/composer.json @@ -1,9 +1,22 @@ { "name": "git_user_id/git_repo_id", "description": "", - "license": "unlicense", "version": "1.0.0", "type": "library", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], "require": { "php": "^8.0", "articus/data-transfer": "^0.5", diff --git a/samples/client/petstore/php-dt/composer.json b/samples/client/petstore/php-dt/composer.json index e50aa59117e..c3baaf4ce39 100644 --- a/samples/client/petstore/php-dt/composer.json +++ b/samples/client/petstore/php-dt/composer.json @@ -1,7 +1,20 @@ { "name": "git_user_id/git_repo_id", "description": "", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "https://openapi-generator.tech", "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], "version": "1.0.0", "type": "library", "require": { diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json index 6a58d7e1f04..fa431b54085 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php/OpenAPIClient-php/composer.json @@ -13,7 +13,7 @@ "license": "unlicense", "authors": [ { - "name": "OpenAPI-Generator contributors", + "name": "OpenAPI", "homepage": "https://openapi-generator.tech" } ], diff --git a/samples/server/petstore/php-laravel/lib/composer.json b/samples/server/petstore/php-laravel/lib/composer.json index a794a18191d..978399b3c9d 100644 --- a/samples/server/petstore/php-laravel/lib/composer.json +++ b/samples/server/petstore/php-laravel/lib/composer.json @@ -2,7 +2,19 @@ "name": "openapitools/petstore", "description": ".", "keywords": ["framework", "laravel"], - "license": "MIT", + "keywords": [ + "openapi", + "php", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], "type": "project", "require": { "php": "^7.2.5", diff --git a/samples/server/petstore/php-lumen/lib/composer.json b/samples/server/petstore/php-lumen/lib/composer.json index 1d25281636a..4ef01d3f3ce 100644 --- a/samples/server/petstore/php-lumen/lib/composer.json +++ b/samples/server/petstore/php-lumen/lib/composer.json @@ -11,11 +11,11 @@ "sdk", "api" ], - "homepage": "http://openapi-generator.tech", + "homepage": "https://openapi-generator.tech", "license": "unlicense", "authors": [ { - "name": "OpenAPI-Generator contributors", + "name": "OpenAPI", "homepage": "https://openapi-generator.tech" } ], diff --git a/samples/server/petstore/php-mezzio-ph-modern/composer.json b/samples/server/petstore/php-mezzio-ph-modern/composer.json index 7f03f079e4a..c40d77b6e18 100644 --- a/samples/server/petstore/php-mezzio-ph-modern/composer.json +++ b/samples/server/petstore/php-mezzio-ph-modern/composer.json @@ -1,7 +1,20 @@ { "name": "git_user_id/git_repo_id", "description": "", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "https://openapi-generator.tech", "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], "version": "1.0.0", "type": "project", "require": { diff --git a/samples/server/petstore/php-mezzio-ph/composer.json b/samples/server/petstore/php-mezzio-ph/composer.json index c98cf998302..d335e88d260 100644 --- a/samples/server/petstore/php-mezzio-ph/composer.json +++ b/samples/server/petstore/php-mezzio-ph/composer.json @@ -1,9 +1,22 @@ { "name": "git_user_id/git_repo_id", "description": "", - "license": "unlicense", "version": "1.0.0", "type": "project", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], "require": { "php": "^7.3 || ^8.0", "ext-yaml": "^2.0", diff --git a/samples/server/petstore/php-slim4/composer.json b/samples/server/petstore/php-slim4/composer.json index 232da8a95cf..2cd44b3ef38 100644 --- a/samples/server/petstore/php-slim4/composer.json +++ b/samples/server/petstore/php-slim4/composer.json @@ -7,6 +7,20 @@ "no-api": true } ], + "description": "", + "keywords": [ + "openapi", + "php", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], "require": { "php": "^7.4 || ^8.0", "dyorg/slim-token-authentication": "dev-slim4", diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json b/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json index 3641be84330..7aaf83d9c76 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/composer.json @@ -7,12 +7,12 @@ "sdk", "api" ], - "homepage": "https://github.com/openapitools/openapi-generator", + "homepage": "https://openapi-generator.tech", "license": "unlicense", "authors": [ { - "name": "openapi-generator contributors", - "homepage": "https://github.com/openapitools/openapi-generator" + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" } ], "require": {