mirror of
https://github.com/strapi/strapi.git
synced 2025-09-06 15:22:59 +00:00
enhancement: fix type generation for Attribute.Relation by removing uid
This commit is contained in:
parent
758843ffd1
commit
16ac13f00a
@ -69,7 +69,7 @@ module.exports = {
|
||||
params.push(...targetFieldParams);
|
||||
|
||||
// If the options property is defined, transform it to
|
||||
// a type literral node and add it to the params list
|
||||
// a type literal node and add it to the params list
|
||||
if (_.isObject(options)) {
|
||||
params.push(toTypeLiteral(options));
|
||||
}
|
||||
@ -93,25 +93,18 @@ module.exports = {
|
||||
media() {
|
||||
return [withAttributeNamespace('Media')];
|
||||
},
|
||||
relation({ uid, attribute }) {
|
||||
relation({ attribute }) {
|
||||
const { relation, target } = attribute;
|
||||
|
||||
const isMorphRelation = relation.toLowerCase().includes('morph');
|
||||
|
||||
if (isMorphRelation) {
|
||||
return [
|
||||
withAttributeNamespace('Relation'),
|
||||
[factory.createStringLiteral(uid, true), factory.createStringLiteral(relation, true)],
|
||||
];
|
||||
return [withAttributeNamespace('Relation'), [factory.createStringLiteral(relation, true)]];
|
||||
}
|
||||
|
||||
return [
|
||||
withAttributeNamespace('Relation'),
|
||||
[
|
||||
factory.createStringLiteral(uid, true),
|
||||
factory.createStringLiteral(relation, true),
|
||||
factory.createStringLiteral(target, true),
|
||||
],
|
||||
[factory.createStringLiteral(relation, true), factory.createStringLiteral(target, true)],
|
||||
];
|
||||
},
|
||||
component({ attribute }) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user