swagger-api / swagger-api/swagger-codegen-generators

Default type for path parameters when missing in spec

Open
#953 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Hi there. I've had this little issue where the generated code wouldn't compile.

My specific case is a C# client for an API written using FastAPI(Python).
The problem arose, when one of the parameters for a method was not typed, and hence the resulting generated spec does not contain a type.

The result was an APIAccessor implementaion which did not compile.

I'm not too sure what the right way forward is, but, in this case, the parameter was a path-parameter, and I do believe that those could safely be assumed to be of type string(or at least in C# object).

I'm not sure which way is the right way to suggest this, as I could see it being more a question of principle.
I intend on writing a similar "proposal" for FastAPI, to attach a string-type to untyped path-parameters.

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 by reproducing C# client generation from a FastAPI case where a path parameter has no type, then inspect the generated specification and APIAccessor implementation. Done means the generated client compiles and the handling of an untyped path parameter is defined consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, fastapi, openapi, python
Domain
api, backend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.