-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update proposal for custom attributes schema #456
Open
melnikovi
wants to merge
12
commits into
magento:master
Choose a base branch
from
magento-honey-badgers:custom-attributes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+476
−31
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
11be876
Update custom attributes container proposal to account for attributes…
melnikovi 72a2238
Update custom attributes container proposal to account for attributes…
melnikovi 3205dd0
Update custom attributes container proposal to account for attributes…
melnikovi 7a191b5
modifying proposal
cpartica c12eb3e
adding interfaces on inputs
cpartica c711235
refactor some things on product attributes
cpartica 763fd6d
- refactor options
cpartica c2d29e2
- reactor types
cpartica 27243fb
- refactor container explanation
cpartica 49ed712
- rename option ids
cpartica 74fd87e
refactoring to simplify query and schema
cpartica b365474
refactoring to simplify query and schema
cpartica File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
214 changes: 214 additions & 0 deletions
214
design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.graphqls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
type Query { | ||
customAttributeMetadataV2(attributes: [AttributeMetadataInput!]!): CustomAttributeMetadata | ||
customAttributesLists(listType: CustomAttributesListsEnum): CustomAttributeMetadata | ||
} | ||
|
||
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 | ||
entity_type: EntityTypeEnum | ||
ui_input: UiInputTypeInterface! | ||
} | ||
|
||
type CustomerAttributeMetadata implements AttributeMetadataInterface { | ||
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 ValidationTextInputTypeInterface { | ||
filter: InputValidationFilterEnum | ||
} | ||
|
||
interface FilterableTextInputTypeInterface { | ||
input_validation: FilterableText | ||
} | ||
|
||
interface AttributeOptionsInterface { | ||
attribute_options: [AttributeOptionInterface] | ||
} | ||
|
||
interface AttributeOptionInterface { | ||
uid: ID! | ||
is_default: Boolean | ||
label: String | ||
} | ||
|
||
interface SelectableInputTypeInterface { | ||
|
||
} | ||
|
||
interface TextInputTypeInterface { | ||
default_value: String | ||
} | ||
|
||
type FilterableText { | ||
input_validation_type: InputValidationTypeEnum | ||
minimum_text_length: Int | ||
maximum_text_length: Int | ||
} | ||
|
||
type TextUiInputType implements UiInputTypeInterface, TextInputTypeInterface, FilterableTextInputTypeInterface, ValidationTextInputTypeInterface { | ||
|
||
} | ||
|
||
type TextAreaUiInputType implements UiInputTypeInterface, TextInputTypeInterface, FilterableTextInputTypeInterface, ValidationTextInputTypeInterface { | ||
|
||
} | ||
|
||
type MultipleLineUiInputType implements UiInputTypeInterface, TextInputTypeInterface, FilterableTextInputTypeInterface, ValidationTextInputTypeInterface { | ||
lines_count: Int | ||
} | ||
|
||
type DateUiInputType implements UiInputTypeInterface, TextInputTypeInterface, FilterableTextInputTypeInterface { | ||
minimum_date_allowed: String | ||
maximum_date_allowed: String | ||
} | ||
|
||
type FileUiInputType implements UiInputTypeInterface, TextInputTypeInterface, FilterableTextInputTypeInterface { | ||
maximum_file_size: Int # bytes | ||
allowed_file_extensions: [String] | ||
} | ||
|
||
type ImageUiInputType implements UiInputTypeInterface, TextInputTypeInterface, FilterableTextInputTypeInterface { | ||
maximum_file_size: Int # bytes | ||
allowed_file_extensions: [String] | ||
maximum_image_width: Int # in pixels | ||
maximum_image_height: Int # in pixels | ||
} | ||
|
||
type DropDownUiInputType implements UiInputTypeInterface, SelectableInputTypeInterface, AttributeOptionsInterface { | ||
} | ||
|
||
type MultipleSelectUiInputType implements UiInputTypeInterface, SelectableInputTypeInterface, AttributeOptionsInterface { | ||
} | ||
|
||
interface SwatchInputTypeInterface { | ||
update_product_preview_image: Boolean | ||
} | ||
|
||
type VisualSwatchUiInputType implements UiInputTypeInterface, SelectableInputTypeInterface, AttributeOptionsInterface, SwatchInputTypeInterface { | ||
use_product_image_for_swatch_if_possible: Boolean | ||
} | ||
|
||
type TextSwatchUiInputType implements UiInputTypeInterface, SelectableInputTypeInterface, AttributeOptionsInterface, SwatchInputTypeInterface { | ||
|
||
} | ||
|
||
type AttributeOption implements AttributeOptionInterface { | ||
value: String @deprecated(reason: "use `uid` instead") | ||
label: String | ||
} | ||
|
||
interface SelectableInputTypeInterface { | ||
|
||
} | ||
|
||
type ColorSwatchAttributeOption implements AttributeOptionInterface { | ||
color: String # html hex code format | ||
} | ||
|
||
type ImageSwatchAttributeOption implements AttributeOptionInterface { | ||
image_path: String # relative path | ||
} | ||
|
||
type TextSwatchAttributeOption implements AttributeOptionInterface { | ||
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 | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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