Skip to content

Commit e26c20b

Browse files
authored
Merge pull request #16 from AndrewWalsh/security-schemas-naming
Ensure securitySchemes auth names are formatted without whitespaces
2 parents 7469d8d + a6700d5 commit e26c20b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib/endpoints-to-oai31.helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,5 @@ export const createQueryParameterTypes = (
169169

170170
// Format THIS_TXT_STR to this text str
171171
export const formatAuthType = (str: string) => {
172-
return str.replace(/_/g, " ").toLowerCase();
172+
return str.toLowerCase();
173173
};

src/lib/endpoints-to-oai31.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ it("sets api keys from headers", () => {
140140
const endpoints = store.endpoints();
141141
const oai31 = endpointsToOAI31(endpoints, defaultOptions);
142142
expect(oai31.rootDoc.components?.securitySchemes).toEqual({
143-
[formatAuthType(AuthType.APIKEY_COOKIE_ + "SESSIONID")]: {
143+
[`${AuthType.APIKEY_COOKIE_.toLowerCase()}sessionid`]: {
144144
in: "cookie",
145145
name: "sessionid",
146146
type: "apiKey",
147147
},
148-
[formatAuthType(AuthType.APIKEY_HEADER_ + "COOKIE")]: {
148+
[`${AuthType.APIKEY_HEADER_.toLowerCase()}cookie`]: {
149149
in: "header",
150150
name: "COOKIE",
151151
type: "apiKey",
152152
},
153-
[formatAuthType(AuthType.APIKEY_HEADER_ + "X-API-KEY")]: {
153+
[`${AuthType.APIKEY_HEADER_.toLowerCase()}x-api-key`]: {
154154
in: "header",
155155
name: "X-API-KEY",
156156
type: "apiKey",

0 commit comments

Comments
 (0)