diff --git a/packages/core/e2e/custom-fields.e2e-spec.ts b/packages/core/e2e/custom-fields.e2e-spec.ts index b31327eab1..a39d7c7394 100644 --- a/packages/core/e2e/custom-fields.e2e-spec.ts +++ b/packages/core/e2e/custom-fields.e2e-spec.ts @@ -215,6 +215,9 @@ describe('Custom fields', () => { type list } + ... on RelationCustomFieldConfig { + scalarFields + } } } } @@ -241,7 +244,25 @@ describe('Custom fields', () => { { name: 'validateFn2', type: 'string', list: false }, { name: 'validateFn3', type: 'string', list: false }, { name: 'validateFn4', type: 'string', list: false }, - { name: 'validateRelation', type: 'relation', list: false }, + { + name: 'validateRelation', + type: 'relation', + list: false, + scalarFields: [ + 'id', + 'createdAt', + 'updatedAt', + 'name', + 'type', + 'fileSize', + 'mimeType', + 'width', + 'height', + 'source', + 'preview', + 'customFields', + ], + }, { name: 'stringWithOptions', type: 'string', list: false }, { name: 'nullableStringWithOptions', type: 'string', list: false }, { name: 'nonPublic', type: 'string', list: false }, @@ -273,6 +294,9 @@ describe('Custom fields', () => { type list } + ... on RelationCustomFieldConfig { + scalarFields + } } } } @@ -303,7 +327,25 @@ describe('Custom fields', () => { { name: 'validateFn2', type: 'string', list: false }, { name: 'validateFn3', type: 'string', list: false }, { name: 'validateFn4', type: 'string', list: false }, - { name: 'validateRelation', type: 'relation', list: false }, + { + name: 'validateRelation', + type: 'relation', + list: false, + scalarFields: [ + 'id', + 'createdAt', + 'updatedAt', + 'name', + 'type', + 'fileSize', + 'mimeType', + 'width', + 'height', + 'source', + 'preview', + 'customFields', + ], + }, { name: 'stringWithOptions', type: 'string', list: false }, { name: 'nullableStringWithOptions', type: 'string', list: false }, { name: 'nonPublic', type: 'string', list: false }, diff --git a/packages/core/src/api/resolvers/admin/global-settings.resolver.ts b/packages/core/src/api/resolvers/admin/global-settings.resolver.ts index 0751f02c9a..0c677c0fa0 100644 --- a/packages/core/src/api/resolvers/admin/global-settings.resolver.ts +++ b/packages/core/src/api/resolvers/admin/global-settings.resolver.ts @@ -141,7 +141,7 @@ export class GlobalSettingsResolver { .map(c => { // In the VendureConfig, the relation entity is specified // as the class, but the GraphQL API exposes it as a string. - const customFieldConfig: GraphQLCustomFieldConfig = c as any; + const customFieldConfig: GraphQLCustomFieldConfig = { ...c } as any; if (this.isRelationGraphQLType(customFieldConfig) && this.isRelationConfigType(c)) { customFieldConfig.entity = c.entity.name; customFieldConfig.scalarFields = this.getScalarFieldsOfType(