Skip to content
Open
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
type Query {
customAttributeMetadataV2(attributes: [AttributeMetadataInput!]!): CustomAttributeMetadata
customAttributesLists(listType: CustomAttributesListsEnum): CustomAttributeMetadata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customAttributesLists - do we need a better name for this

}

type AttributeMetadataInput {
attribute_uid: ID
}

type CustomAttributeMetadata { # this replaces existing Attribute type
items: [AttributeMetadataInterface]
}

interface AttributeMetadataInterface { # base metadata common to all attributes
uid: ID # base64Encode(entityID/codeID)
label: String
data_type: ObjectDataTypeEnum # string, int, float, boolean etc
sort_order: Int
}

interface AttributeMetadataEntityTypeInterface {
entity_type: EntityTypeEnum
}

interface AttributeMetadataUiTypeInterface {
ui_input: UiInputTypeInterface!
}

type CustomerAttributeMetadata implements AttributeMetadataInterface, AttributeMetadataEntityTypeInterface, AttributeMetadataUiTypeInterface {
# ui_input_type: UiInputTypeInterface! #imported
# entity_type: EntityTypeEnum #imported
forms_to_use_in: [CustomAttributesListsEnum]
}

type CustomerAddressAttributeMetadata implements AttributeMetadataInterface {
}

type ProductAttributeMetadata implements AttributeMetadataInterface {
lists_to_use_in: [CustomAttributesListsEnum]
}

# interfaces for different types used in inputs --------------

interface UiInputTypeInterface {
ui_input_type: EntityTypeEnum
is_value_required: Boolean!
}

interface InputFilterInterface {
filter: InputValidationFilterEnum
}

interface InputValidationInterface {
input_validation_type: InputValidationTypeEnum
minimum_text_length: Int
maximum_text_length: Int
}

interface AttributeOptionsInterface {
attribute_options: [AttributeOptionInterface]
}

interface AttributeOptionInterface {
uid: ID!
is_default: Boolean
}

# --------------
type TextUiInputType implements UiInputTypeInterface, InputValidationInterface, InputFilterInterface {
default_value: String
}

#--------------

type TextAreaUiInputType implements UiInputTypeInterface, InputValidationInterface, InputFilterInterface {
default_value: String
}

type MultipleLineUiInputType implements UiInputTypeInterface, InputValidationInterface, InputFilterInterface {
default_value: String
lines_count: Int
}

type DateUiInputType implements UiInputTypeInterface, InputValidationInterface {
default_value: String
minimum_date_allowed: String
maximum_date_allowed: String
}

type FileUiInputType implements UiInputTypeInterface, InputValidationInterface {
default_value: String
maximum_file_size: Int # bytes
allowed_file_extensions: [String]
}

type ImageUiInputType implements UiInputTypeInterface, InputValidationInterface {
default_value: String
maximum_file_size: Int # bytes
allowed_file_extensions: [String]
maximum_image_width: Int # in pixels
maximum_image_height: Int # in pixels
}

interface SingleSelectionUiInputTypeInterface {
default_option_id: ID
}

interface MultipleSelectionUiInputTypeInterface {
default_options_ids: [ID]
}

type DropDownUiInputType implements UiInputTypeInterface, AttributeOptionsInterface, SingleSelectionUiInputTypeInterface {
}

type MultipleSelectUiInputType implements UiInputTypeInterface, AttributeOptionsInterface, MultipleSelectionUiInputTypeInterface {
}

type VisualSwatchUiInputType implements UiInputTypeInterface, AttributeOptionsInterface, SingleSelectionUiInputTypeInterface {
update_product_preview_image: Boolean
use_product_image: Boolean # use product image for swatch if possible
}

type TextSwatchUiInputType implements UiInputTypeInterface, AttributeOptionsInterface, SingleSelectionUiInputTypeInterface {
update_product_preview_image: Boolean
}


#other types definitions for other entities -------
type AttributeOption implements AttributeOptionInterface {
value: String @deprecated(reason: "use `uid` instead")
label: String
}

type ColorSwatchAttributeOption implements AttributeOptionInterface {
color: String # html hex code format
label: String
}

type ImageSwatchAttributeOption implements AttributeOptionInterface {
image_path: String # relative path
label: String
}

type TextSwatchAttributeOption implements AttributeOptionInterface {
title: String
description: String
}

#enums to support above queries
enum ObjectDataTypeEnum {
STRING
FLOAT
INT
BOOLEAN
}

enum EntityTypeEnum {
CUSTOMER
CUSTOMER_ADDRESS
CATALOG_CATEGORY
CATALOG_PRODUCT
ORDER
INVOICE
CREDITMEMO
SHIPMENT
RMA_ITEM
GENERIC
}

enum UiInputTypeEnum {
TEXT
TEXTAREA
MULTILINE
DATE
DATETIME
SELECT
MULTISELECT
BOOLEAN
FILE
IMAGE
SWATCH_VISUAL
SWATCH_TEXT
PRICE
MEDIA_IMAGE
WEEE
}

enum InputValidationTypeEnum {
ALPHANUMERIC
ALPHANUMERIC_WITH_SPACES
NUMERIC_ONLY
ALLPHA_ONLY
DATE
URL
EMAIL
LENGTH_ONLY
}

enum InputValidationFilterEnum {
STRIPTAGS
ESCAPEHTML
DATE
}

enum CustomerAttributeFormsEnum {
CUSTOMER_ACCOUNT_CREATE
CUSTOMER_ACCOUNT_EDIT
ADMINHTML_CHECKOUT
}

enum CustomAttributesListsEnum {
PRODUCTS_COMPARE
PRODUCTS_LISTING
ADVANCED_CATALOG_SEARCH
PRODUCT_SORT
PRODUCT_FILTER
PRODUCT_SEARCH_RESULTS
PRODUCT_AGGREGATIONS
RMA_FORM
CUSTOMER_REGISTRATION_FORM
CUSTOMER_ADDRESS_FORM
}
Loading