mirror of
https://github.com/strapi/strapi.git
synced 2025-09-07 15:49:24 +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);
|
params.push(...targetFieldParams);
|
||||||
|
|
||||||
// If the options property is defined, transform it to
|
// 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)) {
|
if (_.isObject(options)) {
|
||||||
params.push(toTypeLiteral(options));
|
params.push(toTypeLiteral(options));
|
||||||
}
|
}
|
||||||
@ -93,25 +93,18 @@ module.exports = {
|
|||||||
media() {
|
media() {
|
||||||
return [withAttributeNamespace('Media')];
|
return [withAttributeNamespace('Media')];
|
||||||
},
|
},
|
||||||
relation({ uid, attribute }) {
|
relation({ attribute }) {
|
||||||
const { relation, target } = attribute;
|
const { relation, target } = attribute;
|
||||||
|
|
||||||
const isMorphRelation = relation.toLowerCase().includes('morph');
|
const isMorphRelation = relation.toLowerCase().includes('morph');
|
||||||
|
|
||||||
if (isMorphRelation) {
|
if (isMorphRelation) {
|
||||||
return [
|
return [withAttributeNamespace('Relation'), [factory.createStringLiteral(relation, true)]];
|
||||||
withAttributeNamespace('Relation'),
|
|
||||||
[factory.createStringLiteral(uid, true), factory.createStringLiteral(relation, true)],
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
withAttributeNamespace('Relation'),
|
withAttributeNamespace('Relation'),
|
||||||
[
|
[factory.createStringLiteral(relation, true), factory.createStringLiteral(target, true)],
|
||||||
factory.createStringLiteral(uid, true),
|
|
||||||
factory.createStringLiteral(relation, true),
|
|
||||||
factory.createStringLiteral(target, true),
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
component({ attribute }) {
|
component({ attribute }) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user