How to make custom media fields?

In V4 I see that the schemas are defined as js files instead of json. See strapi/packages/core/upload/server/content-types at main · strapi/strapi · GitHub.
The JSON override seems to have no effect, nor seems possible to override those JS files.

I use a TypeScript template and the only override I am able to do is with the “imperative API”, i.e. put a src/extensions/upload/strapi-server.ts with

export default (plugin) => {
  const file = plugin.contentTypes["file"];
  // ...customize file
  // then plugin.contentTypes["file"] = file
  return plugin;
};

I really don’t like this approach. I wish I could modify the schemas

1 Like