Skip to content

Commit

Permalink
Don't use JSONObject for transform. (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
A5rocks authored Jun 15, 2023
1 parent 61229a8 commit 3618eb0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ declare namespace fastifySwagger {
/**
* custom function to transform the route's schema and url
*/
transform?: <S extends FastifySchema = FastifySchema>({ schema, url }: { schema: S, url: string }) => { schema: JSONObject, url: string };
transform?: <S extends FastifySchema = FastifySchema>({ schema, url }: { schema: S, url: string }) => { schema: FastifySchema, url: string };

refResolver?: {
/** Clone the input schema without changing it. Default to `false`. */
Expand Down
4 changes: 2 additions & 2 deletions test/types/http2-types.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fastify from 'fastify';
import fastifySwagger, {JSONObject} from '../..';
import fastifySwagger from '../..';
import { minimalOpenApiV3Document } from './minimal-openapiV3-document';

const app = fastify({
Expand All @@ -9,7 +9,7 @@ const app = fastify({
app.register(fastifySwagger);
app.register(fastifySwagger, {});
app.register(fastifySwagger, { transform: ({schema, url}) => ({
schema: schema as unknown as JSONObject,
schema: schema,
url: url,
})});
app.register(fastifySwagger, {
Expand Down
4 changes: 2 additions & 2 deletions test/types/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fastifySwagger, {
SwaggerOptions,
FastifySwaggerInitOAuthOptions,
FastifySwaggerUiConfigOptions,
FastifySwaggerUiHooksOptions, JSONObject,
FastifySwaggerUiHooksOptions,
} from "../.."
import { minimalOpenApiV3Document } from './minimal-openapiV3-document';
import { expectType } from "tsd";
Expand All @@ -30,7 +30,7 @@ const uiHooks: FastifySwaggerUiHooksOptions = {
app.register(fastifySwagger);
app.register(fastifySwagger, {});
app.register(fastifySwagger, { transform: ({schema, url}) => ({
schema: schema as unknown as JSONObject,
schema: schema,
url: url,
})});
app.register(fastifySwagger, {
Expand Down

0 comments on commit 3618eb0

Please sign in to comment.