openapistack / openapi-client-axios

JavaScript client library for consuming OpenAPI-enabled APIs with axios
https://openapistack.co
MIT License
554 stars 67 forks source link

Query params are not being added to the operation types #40

Open lukeggchapman opened 4 years ago

lukeggchapman commented 4 years ago

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 commented 4 years ago

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

anttiviljami commented 4 years ago

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

lukeggchapman commented 4 years ago

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.

anttiviljami commented 4 years ago

@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?

npdev453 commented 3 years ago

@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?