-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redefine types for validations in a way that works for doc generation
- Loading branch information
1 parent
392861a
commit 8e6f4d3
Showing
4 changed files
with
62 additions
and
29 deletions.
There are no files selected for viewing
48 changes: 31 additions & 17 deletions
48
packages/ui-extensions/src/surfaces/admin/api/checkout-rules/launch-options.ts
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 |
---|---|---|
@@ -1,20 +1,34 @@ | ||
import {Metafield} from './metafields'; | ||
interface Metafield { | ||
description?: string; | ||
id: string; | ||
namespace: string; | ||
key: string; | ||
value: string; | ||
type: string; | ||
} | ||
|
||
interface Validation { | ||
/** | ||
* the validation's gid when active in a shop | ||
*/ | ||
id: string; | ||
/** | ||
* the metafields owned by the validation | ||
*/ | ||
metafields: Metafield[]; | ||
} | ||
|
||
interface ShopifyFunction { | ||
/** | ||
* the validation function's unique identifier | ||
*/ | ||
id: string; | ||
} | ||
|
||
/** | ||
* The object that exposes the validation with its settings. | ||
*/ | ||
export interface ValidationData { | ||
validation?: { | ||
/** | ||
* the validation's gid when active in a shop | ||
*/ | ||
id: string; | ||
/** | ||
* the metafields owned by the validation | ||
*/ | ||
metafields: Metafield[]; | ||
}; | ||
shopifyFunction: { | ||
/** | ||
* the validation function's unique identifier | ||
*/ | ||
id: string; | ||
}; | ||
validation?: Validation; | ||
shopifyFunction: ShopifyFunction; | ||
} |
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
25 changes: 25 additions & 0 deletions
25
packages/ui-extensions/src/surfaces/admin/api/checkout-rules/validation-settings.doc.ts
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,25 @@ | ||
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'; | ||
|
||
const data: ReferenceEntityTemplateSchema = { | ||
name: 'Validation Settings API', | ||
description: | ||
'This API is available Validation Settings extensions. Refer to the [tutorial](/docs/apps/checkout/validation/create-complex-validation-rules) for more information. Note that the [`FunctionSettings`](/docs/api/admin-extensions/components/forms/functionsettings) component is required to build Validation Settings extensions.', | ||
isVisualComponent: false, | ||
type: 'API', | ||
definitions: [ | ||
{ | ||
title: 'applyMetafieldChange', | ||
description: 'Applies a change to the validation settings.', | ||
type: 'ApplyMetafieldChange', | ||
}, | ||
{ | ||
title: 'data', | ||
description: 'The object that exposes the validation with its settings.', | ||
type: 'ValidationData', | ||
}, | ||
], | ||
category: 'API', | ||
related: [], | ||
}; | ||
|
||
export default data; |
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