Skip to content

Commit

Permalink
Merge pull request #16 from AndrewWalsh/security-schemas-naming
Browse files Browse the repository at this point in the history
Ensure securitySchemes auth names are formatted without whitespaces
  • Loading branch information
AndrewWalsh authored Mar 26, 2024
2 parents 7469d8d + a6700d5 commit e26c20b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/endpoints-to-oai31.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,5 @@ export const createQueryParameterTypes = (

// Format THIS_TXT_STR to this text str
export const formatAuthType = (str: string) => {
return str.replace(/_/g, " ").toLowerCase();
return str.toLowerCase();
};
6 changes: 3 additions & 3 deletions src/lib/endpoints-to-oai31.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ it("sets api keys from headers", () => {
const endpoints = store.endpoints();
const oai31 = endpointsToOAI31(endpoints, defaultOptions);
expect(oai31.rootDoc.components?.securitySchemes).toEqual({
[formatAuthType(AuthType.APIKEY_COOKIE_ + "SESSIONID")]: {
[`${AuthType.APIKEY_COOKIE_.toLowerCase()}sessionid`]: {
in: "cookie",
name: "sessionid",
type: "apiKey",
},
[formatAuthType(AuthType.APIKEY_HEADER_ + "COOKIE")]: {
[`${AuthType.APIKEY_HEADER_.toLowerCase()}cookie`]: {
in: "header",
name: "COOKIE",
type: "apiKey",
},
[formatAuthType(AuthType.APIKEY_HEADER_ + "X-API-KEY")]: {
[`${AuthType.APIKEY_HEADER_.toLowerCase()}x-api-key`]: {
in: "header",
name: "X-API-KEY",
type: "apiKey",
Expand Down

0 comments on commit e26c20b

Please sign in to comment.