swagger-api / swagger-api/swagger-codegen

[PowerShell] Not able to specify authentication, basePath, etc.

Open
#9,409 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When the PowerShell wrapper is generated from the csharp code it doesn't have the ability to specify authentication parameters or the basePath. Because of this you are left hard coding these items in the csharp code (and/or hardcoding the host/basePath in the API specification). This both not very scalable and not secure.

Swagger-codegen version

2.4.4

Swagger declaration file content or url

N/A

Command line used for generation

java -jar swagger-codegen-cli.jar generate -i "./api.json" -l csharp -o "./output/csharp/SwaggerClient"
java -jar swagger-codegen-cli.jar generate -i "./api.json" -l powershell -o "./output"
.\Build.ps1

Steps to reproduce

Generate csharp code from API specification
Generate PowerShell code from API specification
Build

Related issues/PRs

https://github.com/swagger-api/swagger-codegen/issues/5886

Suggest a fix/enhancement

There should be access from PowerShell into the ApiClient in the csharp module in order to set configuration items like you would in a csharp project.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated PowerShell wrapper, the C# ApiClient, and Build.ps1 using the two generation commands in the issue. Trace how authentication and basePath are configured in the C# module and how the PowerShell wrapper accesses it. Done means generated PowerShell clients can specify those configuration items without hardcoding them in the C# code or API specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.