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

Issue with in-path parameters #10

Open
yebrahim opened this issue Aug 29, 2018 · 2 comments
Open

Issue with in-path parameters #10

yebrahim opened this issue Aug 29, 2018 · 2 comments

Comments

@yebrahim
Copy link

Hi. Thanks so much for providing this library, it's the simplest and lightest I found so far!

I have an issue when generating a Tyepscript client library though. I have a resource definition like this in swagger:

    "/apis/myresources/{id}": {
      "get": {
        "operationId": "GetMyResource",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
      },
    },

Which generates the following Typescript client code:

    public GetMyResource( id:string ):Promise<apiMyResource>{
        const params = { 
            "id":id 
        };
        return new Promise<apiMyResource>((resolve, reject) => {
            request
            .get("/apis/myresources/{id}")
            .query(params)
            .end(function(error, res){
                if(error){
                    reject(error);
                }else{
                   resolve(res.body as apiMyResource);
                }
            });
        });
    }

This doesn't seem right to me though, since now the request goes to /apis/myresources/{id}?id=123 instead of /apis/myresources/123. Is there anything I missed here or does this need a fix?

@wolever
Copy link

wolever commented Apr 9, 2019

I'm also having this issue. As far as I can tell, URL parameters aren't supported at all.

@webmonger
Copy link

Can you check the latest version from github not NPM? I cant remember exactly but I changed something to do with the querystring in one of my PRs.

If not should be an easy fix.

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

No branches or pull requests

3 participants