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

[BUG] Path params not generated #240

Closed
prasmussen opened this issue Sep 7, 2021 · 3 comments · Fixed by #241
Closed

[BUG] Path params not generated #240

prasmussen opened this issue Sep 7, 2021 · 3 comments · Fixed by #241
Assignees
Labels
bug Something isn't working

Comments

@prasmussen
Copy link

Describe the bug
The following swagger definition does not generate a function argument for the defined path param. The path param is defined as a Common Parameters for All Methods of a Path which seems to not be supported?

To Reproduce
Swagger:

{
  "openapi": "3.0.0",
  "info": {
    "title": "path-params-demo",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "http://localhost:3000"
    }
  ],
  "paths": {
    "/users/{userId}": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "userId",
          "in": "path",
          "required": true,
          "description": "user id"
        }
      ],
      "get": {
        "summary": "get user",
        "tags": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "get-users-userId"
      }
    }
  },
  "components": {
    "schemas": {},
    "parameters": {}
  }
}

Generated code:

@override
Future<Response<dynamic>> usersUserIdGet() {
  final $url = '/users/{userId}';
  final $request = Request('GET', $url, client.baseUrl);
  return client.send<dynamic, dynamic>($request);
}

Expected behavior
Expected generated function to take userId as argument

Library version used:
Commit: 63cdc32

@prasmussen prasmussen added bug Something isn't working Triage needed labels Sep 7, 2021
@Vovanella95
Copy link
Collaborator

Hi @prasmussen , looks like easy fix. Will fix it today

@Vovanella95
Copy link
Collaborator

@prasmussen , enjoy 2.1.1+3 version already in pub.dev

Please, let us know in case of any issues

@prasmussen
Copy link
Author

It works now 👍
Thanks a lot for the quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants