-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
issue: feature requestIssue suggesting a new featureIssue suggesting a new feature
Description
Bug report
Required System information
Environment: development
OS: darwin-arm64
Strapi Version: 4.14.5
Node/Yarn Version: yarn/1.22.19 npm/? node/v18.12.1 darwin arm64
Edition: Community
Database: sqlite
Typescript
Describe the bug
I am currently building a plugin in which I would like to register components. The data type Schema.Component does not provide all required attributes.
- firstly, the info attribute is missing to define the display name
- On the other hand, you have to add
__filename__and__schema__so that you can add new collection-types in the content-type-builder.
Expected behavior
- The data type
Schema.Componentshould provide the attributeinfo - I don't want to set
__filename__and__schema____filename__I don't have a filename__schema__I repeat what I have already defined
Code snippets
This code is working
import { Strapi } from "@strapi/strapi";
export default async ({ strapi }: { strapi: Strapi }) => {
const attributes = { attribut1: { type: "string" } };
const collectionName = "components_huhu_minis";
const info = { displayName: "mini", icon: "alien" };
const __filename__ = "";
const schema = {
collectionName: collectionName,
info: info,
options: {},
attributes: attributes,
__filename__: __filename__,
__schema__: {
collectionName: collectionName,
info: info,
options: {},
attributes: attributes,
__filename__: __filename__,
},
uid: "huhu.mini",
category: "huhu",
modelType: "component",
modelName: "mini",
globalId: "ComponentHuhuMini",
} as any;
strapi.components[schema.uid] = schema;
};
This schema is correct according to the Typescript, but leads to problems because the mentioned attributes are missing
const aValidSchemaTypeButProduceErrors: Schema.Component = {
collectionName: collectionName,
options: {},
attributes: { attribut1: { type: "string" } },
uid: "huhu.mini",
category: "huhu",
modelType: "component",
modelName: "mini",
globalId: "ComponentHuhuMini",
};
Metadata
Metadata
Assignees
Labels
issue: feature requestIssue suggesting a new featureIssue suggesting a new feature