Skip to content

Missing update input schema for struct custom fields #3347

Open
@Draykee

Description

Describe the bug
When adding a struct custom field type, we get an error while validating the schema. Apparently the {Entity}{CustomFieldName}StructInput type is not defined.

Work arounds:

  • Make the field readonly: true, since in this case no update mutation will be created.
  • We can just add the missing struct input ourself:
    Image

To Reproduce
Steps to reproduce the behavior:

  1. Add custom field
config.customFields.GlobalSettings.push({
            type: 'struct',
            name: 'openAiSettings',
            fields: [
                {
                    type: 'string',
                    name: 'openAiEndpoint',
                    label: [{ languageCode: LanguageCode.en, value: 'OpenAI Endpoint' }],
                },
                {
                    type: 'string',
                    name: 'openAiApiKey',
                    label: [{ languageCode: LanguageCode.en, value: 'OpenAI API Key' }],
                    ui: { component: 'password-form-input' },
                },
            ],
        });
  1. Run server

Expected behavior
No error and a working update mutation.

Environment (please complete the following information):

  • @vendure/core version: 3.1.2
  • Nodejs version: 20

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions