UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 1.22 kB
import e from"../../../constants/constants.mjs";import{translate as t}from"../../i18n/translate.mjs";import n from"zod";const r=r=>{let i=[];if(r.headers?.csrf!==void 0&&i.push({in:`header`,name:e.headers.csrf,required:r.headers.csrf,description:t(`server:core.openapi.csrf.header.description`),schema:{type:`string`}}),r.headers?.idempotencyKey!==void 0&&i.push({in:`header`,name:e.headers.idempotencyKey,required:r.headers.idempotencyKey,description:t(`server:core.openapi.idempotency.key.header.description`),schema:{type:`string`}}),r.headers?.authorization!==void 0&&i.push({in:`header`,name:`Authorization`,required:r.headers.authorization,description:t(`server:core.openapi.authorization.header.description`),schema:{type:`string`}}),r.params){let e=n.toJSONSchema(r.params);if(e.properties)for(let[t,n]of Object.entries(e.properties)){let e=n;i.push({name:t,in:`path`,required:!0,description:e.description,example:e.example})}}if(r.query){let e=n.toJSONSchema(r.query);if(e.properties)for(let[t,n]of Object.entries(e.properties)){let r=n;i.push({name:t,in:`query`,required:e.required?.includes(t),description:r.description,example:r.example})}}return i};export{r as default}; //# sourceMappingURL=parameters.mjs.map