Skip to content

Commit

Permalink
fix passing opts in js generator template
Browse files Browse the repository at this point in the history
  • Loading branch information
seriousme committed Jun 14, 2024
1 parent 43cda4b commit d2e4c2c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/generated-javascript-project/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const pluginOptions = {
};

export default async function (fastify, opts) {
fastify.register(openapiGlue, pluginOptions);
fastify.register(openapiGlue, { ...pluginOptions, ...opts });
}

export const options = {
Expand Down
5 changes: 3 additions & 2 deletions lib/templates/js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default (data) => `// Fastify plugin autogenerated by fastify-openapi-glue
export default (data) =>
`// Fastify plugin autogenerated by fastify-openapi-glue
import openapiGlue from "${data.pluginPackageName}";
import { Security } from "./${data.securityFile}";
import { Service } from "./${data.serviceFile}";
Expand All @@ -11,7 +12,7 @@ const pluginOptions = {
};
export default async function (fastify, opts) {
fastify.register(openapiGlue, pluginOptions);
fastify.register(openapiGlue, { ...pluginOptions, ...opts });
}
export const options = {
Expand Down
2 changes: 1 addition & 1 deletion test/test-swagger-noBasePath.v2.javascript.checksums.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"plugin": {
"fileName": "index.js",
"checksum": "87d81a605881e6ba5d6af1266c3fcc30f95b6441290811bb1e5b7e1ce9940cfe"
"checksum": "aaf6dbb034952530335e39a4a48f1b0ac065d00072d0d6156489391de8721451"
},
"readme": {
"fileName": "README.md",
Expand Down
2 changes: 1 addition & 1 deletion test/test-swagger.v2.javascript.checksums.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"plugin": {
"fileName": "index.js",
"checksum": "87d81a605881e6ba5d6af1266c3fcc30f95b6441290811bb1e5b7e1ce9940cfe"
"checksum": "aaf6dbb034952530335e39a4a48f1b0ac065d00072d0d6156489391de8721451"
},
"readme": {
"fileName": "README.md",
Expand Down

0 comments on commit d2e4c2c

Please sign in to comment.