Skip to content

Conversation

aditya-arolkar-swe
Copy link
Contributor

@aditya-arolkar-swe aditya-arolkar-swe commented Aug 20, 2025

Description

A client introduced a new security schema:

components:
 securitySchemes:
    APIKeyQueryParam:
      type: apiKey
      name: apiKey
      in: query

However, we didn't support this and the error thrown wasn't clear.

Changes Made

  • Added support for api keys in query param
  • Added an improved error logging for when we fail to convert securitySchemas

Testing

  • Manual testing completed

Comment on lines 71 to 75
if (convertedSecurityScheme == undefined) {
throw new Error(`Security scheme conversion failed for ${key}: ${JSON.stringify(securityScheme)}`);
}
if (convertedSecurityScheme == null) {
return [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's intended to be the difference between this and the == null check below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't thinking about the null conditional block - was just trying to solve the undefined case. What happened was the returned schema came out as undefined, then when we try to access .type in the code just below we get the error in the CLI output as Cannot read properties of undefined (reading 'type'). This was just hoping to be an earlier error pitstop that would clarify that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caught up sync about the glorious null vs undefined check and == / === in js

passwordEnvVar: basicSecuritySchemeNamingAndEnvvar?.password?.env
});
} else {
throw new Error(`Unsupported HTTP scheme: ${securityScheme.scheme}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's log the key in here too

queryParameterName: securityScheme.name
});
} else {
throw new Error(`Unsupported API key location ${key}: ${securityScheme.in}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to dig in at some point about how we surface CLI errors, I feel like there's a juicier way to do this and make it nicely formatted. But this is okay for now I think

Copy link

This PR is stale because it has been open 25 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale This PR hasn't has any commits or comments in 25 days or more. label Sep 17, 2025
Copy link

This PR was closed because it has been inactive for 5 days after being marked stale.

@github-actions github-actions bot closed this Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale This PR hasn't has any commits or comments in 25 days or more.
Development

Successfully merging this pull request may close these issues.

3 participants