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

[BUG][csharp-netcore] ClientCertificates are not merged with GlobalConfiguration in api constructors #6940

Open
jornhd opened this issue Jul 14, 2020 · 1 comment

Comments

@jornhd
Copy link
Contributor

jornhd commented Jul 14, 2020

Bug Report Checklist

  • [ x ] Have you provided a full/minimal spec to reproduce the issue?
  • [ n/a ] Have you validated the input using an OpenAPI validator (example)?
  • [ x ] What's the version of OpenAPI Generator used?
  • [ x ] Have you search for related issues/PRs?
  • [ n/a ] What's the actual output vs expected output?
  • [ n/a ] [Optional] Bounty to sponsor the fix (example)
Description

The configuration property ClientCertificates added with #5328 is lost in most of the api constructors. These constructors calls method Client.Configuration.MergeConfigurations() to merge the given configuration object with the global configuration. As this method does not handle the ClientCertificates property, the given configuration's certificate collection is lost.

openapi-generator version

4.3.1

OpenAPI declaration file content or url

n/a

Command line used for generation

openapi-generator generate -i SomeApi.json -o SomeApi\output -g csharp-netcore --package-name SomeApi

Steps to reproduce
var config = new Configuration { ClientCertificates = new X509CertificateCollection { new X509Certificate2() } };
var api = new SomeApi(config);

Assert.NotNull(api.Configuration.ClientCertificates);
Related issues/PRs
Suggest a fix

Add merging of the ClientCertificates property in line 411 of modules/openapi-generator/src/main/resources/csharp-netcore/Configuration.mustache:
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,

@bacongobbler
Copy link

Looks like this can be closed as it appears to have been addressed in 6.0.0 (see #11711). Tested locally and found that the ClientCertificates parameter has been added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants