as-services/libs/common/oapi/spec-asyncapi/index.js
devthejo 16b7e7d6aa
All checks were successful
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 47s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Successful in 1m47s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m37s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 2m52s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 3m2s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 31s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m44s
/ deploy (push) Successful in 48s
chore(init): available sources
2025-04-13 10:46:53 +02:00

64 lines
1.4 KiB
JavaScript

const createOptions = require("utils/schema/options")
const optionsSchema = createOptions({
defaults: {
protocol: "ws",
host: "0.0.0.0",
port: 4000,
path: "/",
},
})
async function createApiSpecV1(options = {}) {
optionsSchema(options)
if (process.env.EXTERNAL_PROTOCOL) {
options.protocol = process.env.EXTERNAL_PROTOCOL
}
if (process.env.EXTERNAL_HOST) {
options.host = process.env.EXTERNAL_HOST
}
if (process.env.EXTERNAL_PORT) {
options.port = process.env.EXTERNAL_PORT
}
const apiSpec = {
asyncapi: "3.0.0",
info: {
title: "HelpMe Project API",
version: "1.0.0",
description: "HelpMe Project OpenAPI 3.",
license: {
name: "DEF",
url: "https://devthefuture.org/DEF-LICENSE.md",
},
contact: {
name: "Jo",
email: "jo@devthefuture.org",
// url: "https://",
},
},
servers: {
main: {
host: `${options.host}:${options.port}`,
protocol: options.protocol,
pathname: options.path,
bindings: {
ws: {
query: {
type: "object",
description: "websocket server",
properties: {},
},
},
},
},
},
components: {
schemas: {},
},
channels: {},
}
return apiSpec
}
module.exports = createApiSpecV1