Skip to content

Commit

Permalink
feat(builder): add description to schema for all operations (#1176)
Browse files Browse the repository at this point in the history
Co-authored-by: FuzzB0t <christopherpagnusatt@gmail.com>
  • Loading branch information
noahlitvin and FuzzB0t authored Jul 1, 2024
1 parent e3367e8 commit fca8fa4
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions packages/builder/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function tryParseJson(jsonString: string) {
return undefined;
}

// Note: The first schema defined contains required properties, we then merge a schema with the `deepPartial` function which contains the optional properties

const targetSchema = targetString.or(z.array(targetString).nonempty());

export const deploySchema = z
Expand All @@ -69,6 +71,10 @@ export const deploySchema = z
.merge(
z
.object({
/**
* Description of the operation
*/
description: z.string().describe('Description of the operation'),
/**
* Determines whether contract should get priority in displays
*/
Expand Down Expand Up @@ -208,6 +214,10 @@ export const pullSchema = z
.merge(
z
.object({
/**
* Description of the operation
*/
description: z.string().describe('Description of the operation'),
/**
* ID of the chain to import the package from
*/
Expand Down Expand Up @@ -292,6 +302,10 @@ export const invokeSchema = z
.merge(
z
.object({
/**
* Description of the operation
*/
description: z.string().describe('Description of the operation'),
/**
* JSON file of the contract ABI.
* Required if the target contains an address rather than a contract operation name.
Expand Down Expand Up @@ -493,6 +507,10 @@ export const cloneSchema = z
.merge(
z
.object({
/**
* Description of the operation
*/
description: z.string().describe('Description of the operation'),
/**
* ID of the chain to import the package from.
* Default - 13370
Expand Down Expand Up @@ -574,6 +592,10 @@ export const routerSchema = z
* Set of contracts that will be passed to the router
*/
contracts: z.array(z.string()).describe('Set of contracts that will be passed to the router'),
/**
* Description of the operation
*/
description: z.string().optional().describe('Description of the operation'),
/**
* Include a `receive` function on the router so that it can receive ETH (or, whatever the gas token is on your network).
* NOTE: you can always define `payable` functions on your end-functions to receive ETH as well. This is only for receiving ETH like a regular EOA would.
Expand Down Expand Up @@ -605,7 +627,10 @@ export const varSchema = z
* The setting value to apply
*/
defaultValue: z.string().optional().describe('⚠ Deprecated in favor of var. The value to set in the setting'),
description: z.string().optional().describe('Helpful explanation of the variable being set'),
/**
* Description of the operation
*/
description: z.string().optional().describe('Description of the operation'),
/**
* List of operations that this operation depends on, which Cannon will execute first. If unspecified, Cannon automatically detects dependencies.
*/
Expand Down Expand Up @@ -693,9 +718,9 @@ export const chainDefinitionSchema = z
z
.object({
/**
* Description for the setting
* Description of the operation
*/
description: z.string().describe('Description for the setting'),
description: z.string().describe('Description of the operation'),
/**
* Data type of the value being stored
*/
Expand Down

0 comments on commit fca8fa4

Please sign in to comment.