fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.63k stars 140 forks source link

[Bug] Failed to convert security scheme when a token is present in the query parameter #2297

Open feliche93 opened 10 months ago

feliche93 commented 10 months ago

Describe the bug When I try to convert the pipedrive openapi specs into a fern client I get the following error:

[api]: Failed to convert security scheme {"type":"apiKey","name":"api_token","in":"query"}

To Reproduce Steps to reproduce the behavior:

  1. fern init --openapi https://developers.pipedrive.com/docs/api/v1/openapi.json
  2. fern generate

Expected behavior Gernerated client.

Additional context Not sure if this is the right place to raise this or how I could help fix this! Thanks 🙏

dsinghvi commented 10 months ago

@feliche93 thanks for filing this issue, the root cause here is that Fern does not supporty query params in authentication (https://pipedrive.readme.io/docs/core-api-concepts-authentication#if-youre-working-with-an-api-token-integration).

There are a couple fixes here: 1/ We should not hard fail and provide a better error message 2/ We should support sending a token in the query param

For now, as a workaround, you can: 1) Manually remove the security scheme 2) Generate SDKs 3) Modify the underlying axios (ts) /httpx (python) /okhttp (java) client to send your token and ignore the modifications with .fernignore so that you can successively generate the client library as their API updates.