payload-swagger
Version:
Swagger plugin for payload cms
42 lines (41 loc) • 2.01 kB
JavaScript
;
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.defineGlobal = exports.defineCollection = exports.defineEndpoint = void 0;
function defineEndpoint(endpoint) {
const { summary, description, responseSchema, errorResponseSchemas, queryParameters, custom } = endpoint, rest = __rest(endpoint, ["summary", "description", "responseSchema", "errorResponseSchemas", "queryParameters", "custom"]);
return Object.assign(Object.assign({}, rest), { custom: Object.assign(Object.assign({}, custom), { openapi: {
summary,
description,
responseSchema,
errorResponseSchemas,
queryParameters,
} }) });
}
exports.defineEndpoint = defineEndpoint;
function defineCollection(config) {
const _a = config, { example, examples, custom } = _a, rest = __rest(_a, ["example", "examples", "custom"]);
return Object.assign(Object.assign({}, rest), { custom: Object.assign(Object.assign({}, custom), { openapi: {
example,
examples,
} }) });
}
exports.defineCollection = defineCollection;
function defineGlobal(config) {
const _a = config, { example, examples, custom } = _a, rest = __rest(_a, ["example", "examples", "custom"]);
return Object.assign(Object.assign({}, rest), { custom: Object.assign(Object.assign({}, custom), { openapi: {
example,
examples,
} }) });
}
exports.defineGlobal = defineGlobal;