Skip to content

Commit

Permalink
fix(routes): only add 401 response to schema when auth enabled (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Feb 8, 2023
1 parent b0d982f commit 7ee87e8
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 18 deletions.
4 changes: 4 additions & 0 deletions src/routes/docx/html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const accepts = ["text/html"];
async function route(server, options) {
if (options.bearerTokenAuthKeys) {
docxToHtmlPostSchema.security = [{ bearerToken: [] }];
docxToHtmlPostSchema.response[401] = {
$ref: "responses#/properties/unauthorized",
description: "Unauthorized",
};
}

server.addContentTypeParser(
Expand Down
3 changes: 0 additions & 3 deletions src/routes/docx/html/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ const docxToHtmlPostSchema = {
400: S.ref("responses#/properties/badRequest").description(
"Bad Request"
),
401: S.ref("responses#/properties/unauthorized").description(
"Unauthorized"
),
406: S.ref("responses#/properties/notAcceptable").description(
"Not Acceptable"
),
Expand Down
4 changes: 4 additions & 0 deletions src/routes/docx/txt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const accepts = ["text/plain"];
async function route(server, options) {
if (options.bearerTokenAuthKeys) {
docxToTxtPostSchema.security = [{ bearerToken: [] }];
docxToTxtPostSchema.response[401] = {
$ref: "responses#/properties/unauthorized",
description: "Unauthorized",
};
}

server.addContentTypeParser(
Expand Down
3 changes: 0 additions & 3 deletions src/routes/docx/txt/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ const docxToTxtPostSchema = {
400: S.ref("responses#/properties/badRequest").description(
"Bad Request"
),
401: S.ref("responses#/properties/unauthorized").description(
"Unauthorized"
),
406: S.ref("responses#/properties/notAcceptable").description(
"Not Acceptable"
),
Expand Down
4 changes: 4 additions & 0 deletions src/routes/pdf/html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const accepts = ["text/html"];
async function route(server, options) {
if (options.bearerTokenAuthKeys) {
pdfToHtmlPostSchema.security = [{ bearerToken: [] }];
pdfToHtmlPostSchema.response[401] = {
$ref: "responses#/properties/unauthorized",
description: "Unauthorized",
};
}

server.addContentTypeParser(
Expand Down
3 changes: 0 additions & 3 deletions src/routes/pdf/html/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ const pdfToHtmlPostSchema = {
400: S.ref("responses#/properties/badRequest").description(
"Bad Request"
),
401: S.ref("responses#/properties/unauthorized").description(
"Unauthorized"
),
406: S.ref("responses#/properties/notAcceptable").description(
"Not Acceptable"
),
Expand Down
4 changes: 4 additions & 0 deletions src/routes/pdf/txt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const accepts = ["text/plain", "text/html"];
async function route(server, options) {
if (options.bearerTokenAuthKeys) {
pdfToTxtPostSchema.security = [{ bearerToken: [] }];
pdfToTxtPostSchema.response[401] = {
$ref: "responses#/properties/unauthorized",
description: "Unauthorized",
};
}

server.addContentTypeParser(
Expand Down
3 changes: 0 additions & 3 deletions src/routes/pdf/txt/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ const pdfToTxtPostSchema = {
400: S.ref("responses#/properties/badRequest").description(
"Bad Request"
),
401: S.ref("responses#/properties/unauthorized").description(
"Unauthorized"
),
406: S.ref("responses#/properties/notAcceptable").description(
"Not Acceptable"
),
Expand Down
4 changes: 4 additions & 0 deletions src/routes/rtf/html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const accepts = ["text/html"];
async function route(server, options) {
if (options.bearerTokenAuthKeys) {
rtfToHtmlPostSchema.security = [{ bearerToken: [] }];
rtfToHtmlPostSchema.response[401] = {
$ref: "responses#/properties/unauthorized",
description: "Unauthorized",
};
}

server.addContentTypeParser(
Expand Down
3 changes: 0 additions & 3 deletions src/routes/rtf/html/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ const rtfToHtmlPostSchema = {
400: S.ref("responses#/properties/badRequest").description(
"Bad Request"
),
401: S.ref("responses#/properties/unauthorized").description(
"Unauthorized"
),
406: S.ref("responses#/properties/notAcceptable").description(
"Not Acceptable"
),
Expand Down
4 changes: 4 additions & 0 deletions src/routes/rtf/txt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const accepts = ["text/plain"];
async function route(server, options) {
if (options.bearerTokenAuthKeys) {
rtfToTxtPostSchema.security = [{ bearerToken: [] }];
rtfToTxtPostSchema.response[401] = {
$ref: "responses#/properties/unauthorized",
description: "Unauthorized",
};
}

server.addContentTypeParser(
Expand Down
3 changes: 0 additions & 3 deletions src/routes/rtf/txt/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ const rtfToTxtPostSchema = {
400: S.ref("responses#/properties/badRequest").description(
"Bad Request"
),
401: S.ref("responses#/properties/unauthorized").description(
"Unauthorized"
),
406: S.ref("responses#/properties/notAcceptable").description(
"Not Acceptable"
),
Expand Down

0 comments on commit 7ee87e8

Please sign in to comment.