Skip to content

Commit

Permalink
Merge pull request #835 from zapier/IQQ-1490-fix-array-types
Browse files Browse the repository at this point in the history
fix(schema-to-ts): Simplify Array types (IQQ-1490)
  • Loading branch information
eliangcs authored Aug 13, 2024
2 parents 434805b + 30ea2b8 commit 9c4f119
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 62 deletions.
72 changes: 10 additions & 62 deletions packages/core/types/zapier.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export type RefResource = string;
*/
export type FieldChoices =
| { [k: string]: unknown }
| [string | FieldChoiceWithLabel, ...(string | FieldChoiceWithLabel)[]];
| (string | FieldChoiceWithLabel)[];

/**
* Defines a field an app either needs as input, or gives as output.
Expand Down Expand Up @@ -290,10 +290,8 @@ export interface Field {
* sub-object for this field. Usually used for line items.
*
* @minItems 1
*
* @minItems 1
*/
children?: [Field, ...Field[]];
children?: Field[];

/** Is this field a key/value input? */
dict?: boolean;
Expand Down Expand Up @@ -353,8 +351,6 @@ export interface FunctionSource {
/**
* Function signature. Defaults to `['z', 'bundle']` if not
* specified.
*
* @minItems 0
*/
args?: string[];
}
Expand Down Expand Up @@ -695,8 +691,6 @@ export interface LockObject {
* scopes. Note that "app" is included, always, in the scope
* provided. For example, a scope of ['account', 'auth'] would
* result to ['app', 'account', 'auth'].
*
* @minItems 0
*/
scope?: ('user' | 'auth' | 'account')[];

Expand Down Expand Up @@ -757,8 +751,6 @@ export interface ThrottleObject {
* on account ids for all users under a single account. 'action' -
* Throttles the action it is set on separately from other actions.
* By default, throttling is scoped to the action and account.
*
* @minItems 0
*/
scope?: ('user' | 'auth' | 'account' | 'action')[];

Expand Down Expand Up @@ -787,10 +779,8 @@ export interface ThrottleObject {
* on a Zapier account attribute.
*
* @minItems 1
*
* @minItems 1
*/
overrides?: [ThrottleOverrideObject, ...ThrottleOverrideObject[]];
overrides?: ThrottleOverrideObject[];
}

/**
Expand Down Expand Up @@ -843,18 +833,12 @@ export interface BasicOperation {
*/
perform: Request | Function;

/**
* What should the form a user sees and configures look like?
*
* @minItems 0
*/
/** What should the form a user sees and configures look like? */
inputFields?: DynamicFields;

/**
* What fields of data will this return? Will use resource
* outputFields if missing, will also use sample if available.
*
* @minItems 0
*/
outputFields?: DynamicFields;

Expand Down Expand Up @@ -944,18 +928,12 @@ export interface BasicHookOperation {
*/
performUnsubscribe?: Request | Function;

/**
* What should the form a user sees and configures look like?
*
* @minItems 0
*/
/** What should the form a user sees and configures look like? */
inputFields?: DynamicFields;

/**
* What fields of data will this return? Will use resource
* outputFields if missing, will also use sample if available.
*
* @minItems 0
*/
outputFields?: DynamicFields;

Expand Down Expand Up @@ -999,18 +977,12 @@ export interface BasicPollingOperation {
*/
canPaginate?: boolean;

/**
* What should the form a user sees and configures look like?
*
* @minItems 0
*/
/** What should the form a user sees and configures look like? */
inputFields?: DynamicFields;

/**
* What fields of data will this return? Will use resource
* outputFields if missing, will also use sample if available.
*
* @minItems 0
*/
outputFields?: DynamicFields;

Expand Down Expand Up @@ -1064,18 +1036,12 @@ export interface BasicActionOperation {
*/
performGet?: Request | Function;

/**
* What should the form a user sees and configures look like?
*
* @minItems 0
*/
/** What should the form a user sees and configures look like? */
inputFields?: DynamicFields;

/**
* What fields of data will this return? Will use resource
* outputFields if missing, will also use sample if available.
*
* @minItems 0
*/
outputFields?: DynamicFields;

Expand Down Expand Up @@ -1217,11 +1183,7 @@ export interface Resource {
*/
create?: ResourceMethodCreate;

/**
* What fields of data will this return?
*
* @minItems 0
*/
/** What fields of data will this return? */
outputFields?: DynamicFields;

/** What does a sample of data look like? */
Expand Down Expand Up @@ -1283,18 +1245,12 @@ export interface BasicHookToPollOperation {
*/
performUnsubscribe: Request | Function;

/**
* What should the form a user sees and configures look like?
*
* @minItems 0
*/
/** What should the form a user sees and configures look like? */
inputFields?: DynamicFields;

/**
* What fields of data will this return? Will use resource
* outputFields if missing, will also use sample if available.
*
* @minItems 0
*/
outputFields?: DynamicFields;

Expand Down Expand Up @@ -1389,18 +1345,12 @@ export interface BasicCreateActionOperation {
*/
performGet?: Request | Function;

/**
* What should the form a user sees and configures look like?
*
* @minItems 0
*/
/** What should the form a user sees and configures look like? */
inputFields?: DynamicFields;

/**
* What fields of data will this return? Will use resource
* outputFields if missing, will also use sample if available.
*
* @minItems 0
*/
outputFields?: DynamicFields;

Expand Down Expand Up @@ -1528,8 +1478,6 @@ export interface Authentication {
/**
* Fields you can request from the user before they connect your app
* to Zapier.
*
* @minItems 0
*/
fields?: Fields;

Expand Down
1 change: 1 addition & 0 deletions schema-to-ts/src/precompile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const compileToAST = async (
$refOptions: {
resolve: { customResolver: getResolver(schemas) },
},
ignoreMinAndMaxItems: true,
});
const _schema = structuredClone(rootSchema);

Expand Down

0 comments on commit 9c4f119

Please sign in to comment.