swagger-api / swagger-api/swagger-codegen
codegen API doesn't seem to match any sample code, including the generated readme
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Context: I am trying to make a C# interface to use the Strava API within a Unity project. I've never used Swagger before so there's plenty of room for user error here, but it definitely feels like all the documentation/sample code I can find is just wrong. (In addition to what's below, I've searched for other sample code for using Swagger and cannot find any sample code that matches what I actually have)
Description
I've got the required DLLs in the Plugins folder and have brought in the generated code to a folder in the project, and start writing some code based on the generated swagger/README.md which reads:
// Configure OAuth2 access token for authorization: strava_oauth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
And that's about as far as I get before realizing that the classes that I have here are ...not what is in the readme.

I've confirmed that "Configuration" here is referring to IO.Swagger.Client.Configuration, so it's not finding an unrelated Configuration class in my project. I've also confirmed that DefaultApiClient is not simply a renamed "Default", as there are no members of that even containing the word "token":

The Strava documentation has the same machine-generated sample code here as the readme (and equally invalid, both in terms of the mismatch shown above, but also in terms of having blatantly wrong date syntax for C#). I'm not sure if Swagger generates this sample code or if it grabs it from the Strava documentation.
So my immediate concern is that I have no idea how to set this access token, and more broadly, I am concerned that the fact that what I have doesn't match any sample code means that I've generated something wrongly.
Swagger-codegen version
I don't know how to find this
Command line used for generation
I used this PowerShell line to generate code from the Strava API:
> java -jar .\swagger-codegen-cli.jar generate -i https://developers.strava.com/swagger/swagger.json -l csharp-dotnet2 -o swagger
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the PowerShell generation command with developers.strava.com/swagger/swagger.json and the csharp-dotnet2 generator. Compare generated swagger/README.md with IO.Swagger.Client.Configuration and DefaultApiClient, then check the generated access-token usage against the Strava API definition. Done means the mismatch and token configuration path are explained or corrected, with the relevant example aligned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, java, openapi, unity
- Domain
- api, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100