[php-nextgen] Add Flag to Allow Ignoring Operation Servers#24328
Open
ckoegel wants to merge 2 commits into
Open
[php-nextgen] Add Flag to Allow Ignoring Operation Servers#24328ckoegel wants to merge 2 commits into
ckoegel wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/resources/php-nextgen/Configuration.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/php-nextgen/Configuration.mustache:400">
P3: The new host-selection opt-in has no regression test. Add generated-client coverage for both flag values using distinct operation- and top-level hosts, including an ignored invalid operation `hostIndex`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| * | ||
| * @return $this | ||
| */ | ||
| public function setIgnoreOperationHosts(bool $ignoreOperationHosts): static |
Contributor
There was a problem hiding this comment.
P3: The new host-selection opt-in has no regression test. Add generated-client coverage for both flag values using distinct operation- and top-level hosts, including an ignored invalid operation hostIndex.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/php-nextgen/Configuration.mustache, line 400:
<comment>The new host-selection opt-in has no regression test. Add generated-client coverage for both flag values using distinct operation- and top-level hosts, including an ignored invalid operation `hostIndex`.</comment>
<file context>
@@ -383,6 +390,29 @@ class Configuration
+ *
+ * @return $this
+ */
+ public function setIgnoreOperationHosts(bool $ignoreOperationHosts): static
+ {
+ $this->ignoreOperationHosts = $ignoreOperationHosts;
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a flag to the configuration object to allow for ignoring operation servers. Currently, if operation level host objects are defined, there is no way to ignore these or use a different base path at the SDK level, which many other languages support. The new
ignoreOperationHostsflag allows the user to ignore any operation hosts defined and instead use the currently defined$host. This will default to the top level base path defined in the OpenAPI file, but can be configured to be any url by usingsetIgnoreOperationHosts.2 things to note:
hoststerminology instead ofserverssince this SDK refers to them as hosts already, this means the flag name deviates slightly from other languages, but is consistent with how the rest of the Config refers to this value. It'd be super simple to switch toserversif we value cross language consistency more. Let me know and I'll update that.$operationHostto do the flag check inline, but decided to guard the entire block to avoid the potential for an invalid$hostIndexerror if the config was just going to ignore it anyway. I can do it inline if we want to be as minimally invasive as possible. Also open to making that change, again lmk.PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
@jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ybelenko (2018/07), @renepardon (2018/12)
Summary by cubic
Adds a new
ignoreOperationHostsconfig flag to the PHP next-gen SDK so clients can skip operation-level hosts and always use the configured$host. Updates templates and samples; default behavior is unchanged.ignoreOperationHosts(default false) withsetIgnoreOperationHosts(bool)andgetIgnoreOperationHosts()inConfiguration.$config->getHost()for$operationHostwhen the flag is true; otherwise, existing server indexing and validation are preserved.Written for commit 7228d2e. Summary will update on new commits.