By RightCO
A Strapi plugin that allows to create schemas that the request must follow.
released December 29, 2025
npm install strapi-plugin-request-schemaA plugin for Strapi Headless CMS that provides a way to define a schema at the routes level that will be used to parse the data that is sent in the request.
When exporting, non GET, routes at /api/{api}/routes/{routes}.(js|ts) it is possible to add extra data into the config object.
The plugin searches for routes that have either body or files inside the config object.
Those extra configurations have to follow a set of defined rules when creating the schemas.
Inside the body object can exist any key, but the pair value has to follow a set of rules:
"string", "[string]", "number", "[number]", "boolean", "[boolean]"NOTE: The literals that are inside [] mean that they are expected to be a array of the type inside of it. For example [string] is expected to be a array of strings.
{ method: "POST", path: '...', handler: '...', config: {
body: {
foo: "string" | "[string]" | "number" | "[number]" | "boolean" | "[boolean]",
bar: {
foo: "string" | "[string]" | "number" | "[number]" | "boolean" | "[boolean]",
bar: {
foo: "string" | "[string]" | "number" | "[number]" | "boolean" | "[boolean]",
},
},
foobar: [{
foo: "string" | "[string]" | "number" | "[number]" | "boolean" | "[boolean]",
bar: {
foo: "string" | "[string]" | "number" | "[number]" | "boolean" | "[boolean]",
},
}],
}
}}Inside the files object can exist any key but the pair value has to be any of the literal values: "file", "[file]"
{ method: "POST", path: '...', handler: '...', config: {
files: {
foo: "file" | "[file]",
bar: "file" | "[file]",
}
}}The plugin is currently tested and functional using strapi version 5.24.0
# Using NPM
npm install strapi-plugin-request-schemaAs all other plugins, strapi allows to disable the plugin in /config/plugins.(js|ts) without having to uninstall it.
export default {
// ...
"strapi-plugin-request-schema": {
enabled: false,
},
// ...
}Share your work with the community and get it listed in the Strapi ecosystem for everyone to discover and use.
Submit
