You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add missing conventions & examples to Component Guidelines docs (#2505)
* Add missing conventions & examples to Component Guidelines docs
Added docs for Common Files and Pagination are taken from [this
PR](#1693) by jverce
* Add "getters" to .wordlist.txt
* docs: Add guidelines for action name (omit article)
* Formatting - surround package.json in backticks
@@ -297,6 +299,10 @@ If the app has a well-supported [Node.js client
297
299
library](../api/#using-npm-packages), that should be preferred to manually
298
300
constructed API requests to reduce code and improve maintenance.
299
301
302
+
#### Include dependencies in `package.json`
303
+
304
+
Each app should have a `package.json` in its root folder to track changes in its dependencies. To create a `package.json` file, run `npm init` in the app's root folder and customize it using [this `package.json`](https://github.com/PipedreamHQ/pipedream/blob/55236b3aa993cbcb545e245803d8654c6358b0a2/components/stripe/package.json) as a template.
305
+
300
306
#### Error-handling and input validation
301
307
302
308
When you use the SDK of a popular API, the SDK might raise clear errors to the user. For example, if the user is asked to pass an email address, and that email address doesn't validate, the library might raise that in the error message.
@@ -307,7 +313,27 @@ In general, **imagine you are a user troubleshooting an issue. Is the error easy
307
313
308
314
#### Pagination
309
315
310
-
When making API requests, handle pagination to ensure all data / events are processed.
316
+
When making API requests, handle pagination to ensure all data/events are
317
+
processed. Moreover, if the underlying account experiences and/or generates too
318
+
much data paginating through the entire collection of records, it might cause
319
+
out-of-memory or timeout issues (or both!), so as a rule of thumb the pagination
320
+
logic should:
321
+
322
+
- Be encapsulated as a [generator](https://mzl.la/37z6Sh6) so that the component
323
+
can start processing records after the very first API call. As an example, you
contains a `common` directory instead of a `common.js` file, and the directory
450
+
contains several modules that are shared between different event sources.
451
+
419
452
### Props
420
453
421
454
As a general rule of thumb, we should strive to only incorporate the 3-4 most relevant options from a given API as props. This is not a hard limit, but the goal is to optimize for usability. We should aim to solve specific use cases as simply as possible.
@@ -436,6 +469,7 @@ user understand what they need to do. Use Markdown as appropriate
436
469
to improve the clarity of the description or instructions. When using Markdown:
437
470
438
471
- Enclose sample input values in backticks (`` ` ``)
472
+
- Refer to other props using **bold** by surrounding with double asterisks (*)
439
473
- Use Markdown links with descriptive text rather than displaying a full URL.
440
474
- If the description isn't self-explanatory, link to the API docs of the relevant method to further clarify how the prop works. When the value of the prop is complex (for example, an object with many properties), link to the section of the API docs that include details on this format. Users may pass values from previous steps using [expressions](/workflows/steps/params/#entering-expressions), so they'll need to know how to structure that data.
441
475
@@ -483,7 +517,11 @@ when interacting with the source (e.g., “My Project”). The code referencing
483
517
selection receives the numeric ID (12345).
484
518
485
519
Async options should also support [pagination](../api/#async-options-example)
486
-
(so users can navigate across multiple pages of options for long lists).
520
+
(so users can navigate across multiple pages of options for long lists). See
These guidelines are specific to [source](/event-sources/) development.
@@ -613,6 +656,14 @@ end user. Generate and use a GUID for the shared secret value, save it to a
613
656
614
657
### Action Guidelines
615
658
659
+
#### Action Name
660
+
661
+
Like [source name](#source-name), action name should be a singular, title-cased
662
+
name, should not be slugified, and should not include the app name.
663
+
664
+
As a general pattern, articles are not included in the action name. For example,
665
+
instead of "Create a Post", use "Create Post".
666
+
616
667
#### Use `@pipedream/platform` axios for all HTTP requests
617
668
618
669
By default, the standard `axios` package doesn't return useful debugging data to the user when it `throw`s errors on HTTP 4XX and 5XX status codes. This makes it hard for the user to troubleshoot the issue.
@@ -625,6 +676,32 @@ When you `return` data from an action, it's exposed as a [step export](/workflow
625
676
626
677
For example, some APIs return XML responses. If you return XML from the step, it's harder for users to parse and reference in future steps. Convert the XML to a JavaScript object, and return that, instead.
627
678
679
+
#### "List" actions
680
+
681
+
##### Return an array of objects
682
+
683
+
To simplify using results from "list"/"search" actions in future steps of a
684
+
workflow, return an array of the items being listed rather than an object with a
0 commit comments