MCPcopy Create free account
hub / github.com/Bytez-com/docs / constructOpenApiSpec

Function constructOpenApiSpec

docs/scripts/generatePages/constructOpenApiSpec.js:3–86  ·  view source on GitHub ↗
(task)

Source from the content-addressed store, hash-verified

1const { MODEL_DOCS_OBJECT } = require('./modelDocsObject');
2
3function constructOpenApiSpec(task) {
4 const config = MODEL_DOCS_OBJECT.tasks[task];
5
6 const { description, exampleModel: modelId, openapiSpec } = config;
7
8 const spec = {
9 ...MODEL_DOCS_OBJECT.openapiSpec,
10 paths: {
11 [`/models/v2/${modelId}`]: {
12 post: {
13 summary: task,
14 description,
15 operationId: task,
16 requestBody: {
17 description: `Schema for ${task} models`,
18 required: true,
19 content: {
20 'application/json': {
21 schema: openapiSpec.requestBodyContentSchema,
22 },
23 },
24 },
25 responses: {
26 200: {
27 description: `Successful ${task} response.`,
28 content: {
29 'application/json': {
30 schema: openapiSpec.responseBodyContentSchema,
31 },
32 },
33 },
34 401: {
35 description: "Auth error - check your api key and how you're sending it.",
36 content: {
37 'application/json': {
38 schema: {
39 type: 'object',
40 properties: {
41 error: {
42 type: 'string',
43 example: 'Unauthorized',
44 },
45 output: {
46 type: 'string',
47 example: null,
48 },
49 },
50 },
51 },
52 },
53 },
54 429: {
55 description: 'Too Many Requests – You have hit the rate limit.',
56 content: {
57 'application/json': {
58 schema: {
59 type: 'object',
60 properties: {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected