openapi-client-axios icon indicating copy to clipboard operation
openapi-client-axios copied to clipboard

Query params are not being added to the operation types

Open lukeggchapman opened this issue 3 years ago • 5 comments

In #5 the change was made to allow for all param types to be used in the first argument for an operation, when a operation has both query and path params the typegen only uses the PathParameters.

lukeggchapman avatar Sep 25 '20 01:09 lukeggchapman

Just ran a test and it's working for your example-pet-api.openapi.yml test file, will investigate further.

lukeggchapman avatar Sep 25 '20 02:09 lukeggchapman

It should definitely work. Can you supply a counter example? https://github.com/anttiviljami/openapi-client-axios/blob/master/src/typegen/typegen.ts#L68

anttiviljami avatar Sep 25 '20 02:09 anttiviljami

It might be struggling to find my schema as it's nested in content.

{
  // ...
  "parameters": [
    {
      "name": "organizationId",
      "in": "path",
      "schema": {
        "type": "string"
      },
      "required": true
    },
    {
      "name": "filter",
      "in": "query",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Inventory.Filter"
          }
        }
      }
    }
  ]
  // ...
}

I will investigate further.

lukeggchapman avatar Sep 25 '20 02:09 lukeggchapman

@lukeggchapman I think you might've hit on something here. This might be a problem in the upstream https://github.com/horiuchi/dtsgenerator. I think having the content property in a parameter object is not supported yet. Care to open an issue there?

anttiviljami avatar Sep 25 '20 07:09 anttiviljami

@anttiviljami

related bug in dtsgenerator was fixed in v3.10.0

But I know that we use custom modification of dtsgenerator v2, so can you try to update that fork?

npdev453 avatar May 19 '21 10:05 npdev453