swagger-api / swagger-api/swagger-codegen

C# 3.0.24 based client throws exception on occasional api calls

Open
#10,910 2 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

After transition to Open API and Codegen 3.0.24, some apis throw exception
Same apis work fine when triggered from client generated based based on Open Api 2 for same service

System.AggregateException : One or more errors occurred. (Specified argument was out of the range of valid values. (Parameter 'value'))
----> System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'value')
Stack Trace:
Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
Task1.GetResultCore(Boolean waitCompletionNotification) Task1.get_Result()
ApiClient.CallApi(String path, Method method, List1 queryParams, Object postBody, Dictionary2 headerParams, Dictionary2 formParams, Dictionary2 fileParams, Dictionary2 pathParams, String contentType) line 182 ConfigApi.CreateConfigWithHttpInfo(String projectName, CreateConfigRequest body) line 580 ConfigApi.CreateConfig(String projectName, CreateConfigRequest body) line 520 Program.CreateConfig() line 38 Program.CreateConfigTest() line 22 --ArgumentOutOfRangeException HttpClient.set_Timeout(TimeSpan value) DefaultHttpClientFactory.CreateClient(IRestClient client) <.ctor>b__9_0() Lazy1.ViaFactory(LazyThreadSafetyMode mode)
Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) Lazy1.CreateValue()
RestClientBase.ExecuteRequest(IRestRequest request, CancellationToken ct)
RestClientBase.Execute(IRestRequest request, CancellationToken ct)

Swagger-codegen version

3.0.24

Swagger declaration file content or url
Command line used for generation

java -jar C:\Users\Public\Tools\swagger-codegen-cli-3.0.24.jar generate -i http://laas-int01.laas.icloud.intel.com:19081/station_automation_app/StationAutomationService/swagger/v1/swagger.json -l csharp -o StationAutomationGateway --additional-properties netCoreProjectFile=true,targetFramework=v5.0,packageName=StationAutomationGateway,packageGuid={BCDB43A1-7015-4FBE-BB6B-DEF1917B8990}

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 at ApiClient.CallApi line 182 and DefaultHttpClientFactory.CreateClient, then compare the generated C# client's behavior for OpenAPI 2 and OpenAPI 3. Reproduce CreateConfigWithHttpInfo using swagger-codegen 3.0.24; done when the affected API calls no longer throw ArgumentOutOfRangeException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.