Validation Settings APIAPI
API
This API is available to Validation Settings extensions. Refer to the tutorial for more information. Note that the component is required to build Validation Settings extensions.
Applies a change to the validation settings.
- Anchor to changechangerequired
Promise<>
ApplyMetafieldChange
- change
MetafieldChange
Promise<MetafieldChangeResult>
export type ApplyMetafieldChange = (
change: MetafieldChange,
) => Promise<MetafieldChangeResult>;
MetafieldChange
MetafieldUpdateChange | MetafieldRemoveChange
MetafieldUpdateChange
- key
string
- namespace
string
- type
"updateMetafield"
- value
string | number
- valueType
SupportedDefinitionType
interface MetafieldUpdateChange {
type: 'updateMetafield';
key: string;
namespace?: string;
value: string | number;
valueType?: SupportedDefinitionType;
}
SupportedDefinitionType
(typeof supportedDefinitionTypes)[number]
MetafieldRemoveChange
- key
string
- namespace
string
- type
"removeMetafield"
interface MetafieldRemoveChange {
type: 'removeMetafield';
key: string;
namespace: string;
}
MetafieldChangeResult
MetafieldChangeSuccess | MetafieldChangeResultError
MetafieldChangeSuccess
- type
"success"
interface MetafieldChangeSuccess {
type: 'success';
}
MetafieldChangeResultError
- message
string
- type
"error"
interface MetafieldChangeResultError {
type: 'error';
message: string;
}
Was this section helpful?
Anchor to datadata
The object that exposes the validation with its settings.
- Anchor to shopifyFunctionshopifyFunctionrequired
- Anchor to validationvalidation
ValidationData
The object that exposes the validation with its settings.
- shopifyFunction
ShopifyFunction
- validation
Validation
export interface ValidationData {
validation?: Validation;
shopifyFunction: ShopifyFunction;
}
ShopifyFunction
- id
the validation function's unique identifier
string
interface ShopifyFunction {
/**
* the validation function's unique identifier
*/
id: string;
}
Validation
- id
the validation's gid when active in a shop
string
- metafields
the metafields owned by the validation
Metafield[]
interface Validation {
/**
* the validation's gid when active in a shop
*/
id: string;
/**
* the metafields owned by the validation
*/
metafields: Metafield[];
}
Metafield
- description
string
- id
string
- key
string
- namespace
string
- type
string
- value
string
interface Metafield {
description?: string;
id: string;
namespace: string;
key: string;
value: string;
type: string;
}
Was this section helpful?