Skip to content

Commit

Permalink
Merge pull request #632 from seriousme/export-security-error
Browse files Browse the repository at this point in the history
feat: export SecurityError
  • Loading branch information
seriousme authored Dec 4, 2024
2 parents 8537f99 + c820304 commit 7458fc7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class SecurityError extends Error {
}
}

export default class SecurityHandlers {
export class SecurityHandlers {
/** constructor */
constructor(handlers) {
this.handlers = handlers;
Expand Down
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export interface FastifyOpenapiGlueOptions {
}

declare const fastifyOpenapiGlue: FastifyPluginAsync<FastifyOpenapiGlueOptions>;
declare interface SecurityError extends Error {
statusCode: number;
name: string;
errors: Error[];
}

export default fastifyOpenapiGlue;
export { fastifyOpenapiGlue };
export type { SecurityError };
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fp from "fastify-plugin";
import { Parser } from "./lib/Parser.js";
import SecurityHandlers from "./lib/securityHandlers.js";
import { SecurityError, SecurityHandlers } from "./lib/securityHandlers.js";

function checkObject(obj, name) {
if (typeof obj === "object" && obj !== null) {
Expand Down Expand Up @@ -161,7 +161,7 @@ const fastifyOpenapiGlue = fp(plugin, {
});

export default fastifyOpenapiGlue;
export { fastifyOpenapiGlue };
export { fastifyOpenapiGlue, SecurityError };

export const options = {
specification: "examples/petstore/petstore-openapi.v3.json",
Expand Down
2 changes: 1 addition & 1 deletion lib/securityHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class SecurityError extends Error {
}
}

export default class SecurityHandlers {
export class SecurityHandlers {
/** constructor */
constructor(handlers) {
this.handlers = handlers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"securityHandlers": {
"fileName": "securityHandlers.js",
"checksum": "86252e229179c494fff9e5f0a614351dcedc69b3bd5f65f5882ef22d610b4d71"
"checksum": "69e06db50bc73042bcea1fa0deaeb1f677dbfc009459dd55ad921b7eeb2184dd"
},
"testPlugin": {
"fileName": "test-plugin.js",
Expand Down
2 changes: 1 addition & 1 deletion test/test-swagger.v2.standaloneJS.checksums.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"securityHandlers": {
"fileName": "securityHandlers.js",
"checksum": "86252e229179c494fff9e5f0a614351dcedc69b3bd5f65f5882ef22d610b4d71"
"checksum": "69e06db50bc73042bcea1fa0deaeb1f677dbfc009459dd55ad921b7eeb2184dd"
},
"testPlugin": {
"fileName": "test-plugin.js",
Expand Down

0 comments on commit 7458fc7

Please sign in to comment.