-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[php-nextgen] Respect composerPackageName Config Option
#24943
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg | |||||||||||||||||
| @Setter protected String developerOrganizationUrl = "https://openapi-generator.tech"; | ||||||||||||||||||
| @Setter protected String srcBasePath = "lib"; | ||||||||||||||||||
| @Setter protected String testBasePath = "test"; | ||||||||||||||||||
| @Setter protected String composerPackageName = null; | ||||||||||||||||||
| protected String docsBasePath = "docs"; | ||||||||||||||||||
| protected String apiDirName = "Api"; | ||||||||||||||||||
| protected String modelDirName = "Model"; | ||||||||||||||||||
|
|
@@ -332,6 +333,10 @@ public void processOpts() { | |||||||||||||||||
| this.setGitRepoId((String) additionalProperties.get(CodegenConstants.GIT_REPO_ID)); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if (additionalProperties.containsKey(CodegenConstants.COMPOSER_PACKAGE_NAME)) { | ||||||||||||||||||
| this.setComposerPackageName((String) additionalProperties.get(CodegenConstants.COMPOSER_PACKAGE_NAME)); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if (!this.getComposerPackageName().isEmpty()) { | ||||||||||||||||||
| additionalProperties.put("composerPackageName", this.getComposerPackageName()); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
@@ -1038,11 +1043,15 @@ public void postProcessFile(File file, String fileType) { | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Get Composer package name based on GIT_USER_ID and GIT_REPO_ID. | ||||||||||||||||||
| * Get Composer package name. Returns the explicitly configured value if set, otherwise | ||||||||||||||||||
| * derives it from GIT_USER_ID and GIT_REPO_ID. | ||||||||||||||||||
| * | ||||||||||||||||||
| * @return package name or empty string on fail | ||||||||||||||||||
| */ | ||||||||||||||||||
| public String getComposerPackageName() { | ||||||||||||||||||
| if (this.composerPackageName != null && !this.composerPackageName.isEmpty()) { | ||||||||||||||||||
| return this.composerPackageName; | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
+1052
to
+1054
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: An explicitly configured Prompt for AI agents
Suggested change
|
||||||||||||||||||
| String packageName = this.getGitUserId() + "/" + this.getGitRepoId(); | ||||||||||||||||||
| if ( | ||||||||||||||||||
| packageName.contentEquals("/") | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: The new config-override path in
getComposerPackageName()has no test.AbstractPhpCodegenTest.testGetComposerPackageNameonly exercises the git-derived fallback, so a future refactor that drops thecomposerPackageNamebranch would not be caught. Add a data-provider row (or a dedicated test) that setscomposerPackageNamealongside git ids and asserts the configured value wins, and that an empty configured value falls back to git info.Prompt for AI agents