Skip to content
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

1.0.0-rc4 Example for overriding the content-type header of patching operations do not work #1499

Open
tugtugtug opened this issue Jan 4, 2024 · 4 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@tugtugtug
Copy link

tugtugtug commented Jan 4, 2024

Describe the bug
The configuration passed into the patching APIs do not honor the middleware overrides.
The generated code does not even look at the passed in configuration for the middlewares, it only looks at the middlewares of its member configuration object.
e.g.

    patchNamespacedStatefulSetWithHttpInfo(name, namespace, body, pretty, dryRun, fieldManager, fieldValidation, force, _options) {
        const requestContextPromise = this.requestFactory.patchNamespacedStatefulSet(name, namespace, body, pretty, dryRun, fieldManager, fieldValidation, force, _options);
        // build promise chain
        let middlewarePreObservable = (0, rxjsStub_1.from)(requestContextPromise);
        for (let middleware of this.configuration.middleware) {
            middlewarePreObservable = middlewarePreObservable.pipe((0, rxjsStub_2.mergeMap)((ctx) => middleware.pre(ctx)));
        }

** Client Version **
1.0.0-rc4

** Server Version **
1.25.1

To Reproduce
Steps to reproduce the behavior:

  • make a call to patchNamespacedStatefulSet with the configuration overriding with the middleware.

Expected behavior
The middleware should be called to override the request.

** Example Code**
see https://github.com/kubernetes-client/javascript/blob/62e5ab1701cb5659656f1941ef11eb748e626c25/examples/patch-example.js

Environment (please complete the following information):

  • OS: [Ubuntu 22.04]
  • NodeJS Version [18]
  • Cloud runtime [NA]

Additional context
Related to #1398

Workaround

		return createConfiguration({
			baseServer: baseServerConfig,
			middleware: [mw],
			authMethods: {
				default: {
					applySecurityAuthentication: async (req) => {
						await mw.pre(req).toPromise();
						await kc.applySecurityAuthentication(req);
					}
				},
			},
		});
@brendandburns
Copy link
Contributor

I think that you will need to fix this in the upstream generator:
https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/typescript-fetch

Once the fix is merged there, we can regenerate the client.

@tugtugtug
Copy link
Author

thanks @brendandburns , related to OpenAPITools/openapi-generator#14549

@tugtugtug
Copy link
Author

The above issue was created a year ago, and given the repo's issue # keeps increasing and now at 4k, I don't have faith this will get addressed soon. I'm okay with my workaround for now, I'll keep this open so ppl can find the workaround here.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants