Attempt to figure out why tests are failing.
This commit is contained in:
parent
cd674b8338
commit
8123a04a8e
|
@ -156,6 +156,7 @@
|
||||||
"@types/pouchdb": "6.4.2",
|
"@types/pouchdb": "6.4.2",
|
||||||
"@types/server-destroy": "1.0.1",
|
"@types/server-destroy": "1.0.1",
|
||||||
"@types/supertest": "2.0.14",
|
"@types/supertest": "2.0.14",
|
||||||
|
"@types/swagger-jsdoc": "^6.0.4",
|
||||||
"@types/tar": "6.1.5",
|
"@types/tar": "6.1.5",
|
||||||
"@types/tmp": "0.2.6",
|
"@types/tmp": "0.2.6",
|
||||||
"@types/uuid": "8.3.4",
|
"@types/uuid": "8.3.4",
|
||||||
|
|
|
@ -4,11 +4,11 @@ import { examples, schemas } from "./resources"
|
||||||
import * as parameters from "./parameters"
|
import * as parameters from "./parameters"
|
||||||
import * as security from "./security"
|
import * as security from "./security"
|
||||||
|
|
||||||
const swaggerJsdoc = require("swagger-jsdoc")
|
import swaggerJsdoc from "swagger-jsdoc"
|
||||||
|
|
||||||
const VARIABLES = {}
|
const VARIABLES = {}
|
||||||
|
|
||||||
const options = {
|
const opts: swaggerJsdoc.Options = {
|
||||||
definition: {
|
definition: {
|
||||||
openapi: "3.0.0",
|
openapi: "3.0.0",
|
||||||
info: {
|
info: {
|
||||||
|
@ -58,30 +58,23 @@ const options = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeFile(output: any, filename: string) {
|
function writeFile(output: any, filename: string) {
|
||||||
try {
|
const path = join(__dirname, filename)
|
||||||
const path = join(__dirname, filename)
|
let spec = output
|
||||||
let spec = output
|
if (filename.endsWith("json")) {
|
||||||
if (filename.endsWith("json")) {
|
spec = JSON.stringify(output, null, 2)
|
||||||
spec = JSON.stringify(output, null, 2)
|
|
||||||
}
|
|
||||||
// input the static variables
|
|
||||||
for (let [key, replacement] of Object.entries(VARIABLES)) {
|
|
||||||
spec = spec.replace(new RegExp(`{${key}}`, "g"), replacement)
|
|
||||||
}
|
|
||||||
writeFileSync(path, spec)
|
|
||||||
console.log(`Wrote spec to ${path}`)
|
|
||||||
return path
|
|
||||||
} catch (err) {
|
|
||||||
console.error("Error writing spec file", err)
|
|
||||||
}
|
}
|
||||||
|
// input the static variables
|
||||||
|
for (let [key, replacement] of Object.entries(VARIABLES)) {
|
||||||
|
spec = spec.replace(new RegExp(`{${key}}`, "g"), replacement)
|
||||||
|
}
|
||||||
|
writeFileSync(path, spec)
|
||||||
|
console.log(`Wrote spec to ${path}`)
|
||||||
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
export function run() {
|
export function run() {
|
||||||
const outputJSON = swaggerJsdoc(options)
|
writeFile(swaggerJsdoc({ ...opts, format: ".json" }), "openapi.json")
|
||||||
options.format = ".yaml"
|
return writeFile(swaggerJsdoc({ ...opts, format: ".yaml" }), "openapi.yaml")
|
||||||
const outputYAML = swaggerJsdoc(options)
|
|
||||||
writeFile(outputJSON, "openapi.json")
|
|
||||||
return writeFile(outputYAML, "openapi.yaml")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
|
|
11
yarn.lock
11
yarn.lock
|
@ -2796,9 +2796,9 @@
|
||||||
through2 "^2.0.0"
|
through2 "^2.0.0"
|
||||||
|
|
||||||
"@budibase/pro@npm:@budibase/pro@latest":
|
"@budibase/pro@npm:@budibase/pro@latest":
|
||||||
version "3.4.20"
|
version "3.4.22"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-3.4.20.tgz#0d855d6ed8fe92fd178c74a8963d879cc124b034"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-3.4.22.tgz#943f23cb7056041bc1f433ee60b3d093145e7a4a"
|
||||||
integrity sha512-hUteGvhMOKjBo0fluxcqNs7d4x8OU5W8Oqqrm7eIS9Ohe7ala2iWNCcrj+x+S9CavIm6s7JZZnAewa2Maiz2zQ==
|
integrity sha512-Du3iZsmRLopfoi2SvxQyY1P2Su3Nw0WbITOrKmZFsVLjZ9MzzTZs0Ph/SJHzrfJpM7rn9+8788BLSf3Z3l9KcQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@anthropic-ai/sdk" "^0.27.3"
|
"@anthropic-ai/sdk" "^0.27.3"
|
||||||
"@budibase/backend-core" "*"
|
"@budibase/backend-core" "*"
|
||||||
|
@ -7142,6 +7142,11 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/superagent" "*"
|
"@types/superagent" "*"
|
||||||
|
|
||||||
|
"@types/swagger-jsdoc@^6.0.4":
|
||||||
|
version "6.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/swagger-jsdoc/-/swagger-jsdoc-6.0.4.tgz#bb4f60f3a5f103818e022f2e29ff8935113fb83d"
|
||||||
|
integrity sha512-W+Xw5epcOZrF/AooUM/PccNMSAFOKWZA5dasNyMujTwsBkU74njSJBpvCCJhHAJ95XRMzQrrW844Btu0uoetwQ==
|
||||||
|
|
||||||
"@types/tar-fs@2.0.1":
|
"@types/tar-fs@2.0.1":
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/tar-fs/-/tar-fs-2.0.1.tgz#6391dcad1b03dea2d79fac07371585ab54472bb1"
|
resolved "https://registry.yarnpkg.com/@types/tar-fs/-/tar-fs-2.0.1.tgz#6391dcad1b03dea2d79fac07371585ab54472bb1"
|
||||||
|
|
Loading…
Reference in New Issue