-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update each
function examples
#796
Changes from 2 commits
99af9e6
2a4ffc3
25abf35
84ced30
3696674
4ef09a6
2180938
85aeb6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,12 +267,32 @@ export function asData(data, state) { | |
* the state's references. | ||
* @public | ||
* @function | ||
* @example | ||
* each("$.[*]", | ||
* create("SObject", | ||
* field("FirstName", sourceValue("$.firstName")) | ||
* @example <caption>Inserting patitent data using lazy state. (Only in v2)</caption> | ||
* each($.data, | ||
* insert("patient", | ||
mtuchi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* { | ||
* patient_name: $.data.properties.case_name, | ||
* patient_id: $.data.case_id | ||
* } | ||
* ) | ||
* ) | ||
* @example <caption>Inserting patitent data with custom transformations. (Only in v1)</caption> | ||
mtuchi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* each( | ||
* $.data, | ||
* insert("patient", (state) => ({ | ||
* patient_id: state.data.case_id, | ||
* patient_name: state.data.properties.case_name.toUpperCase(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there are too many props here which bloat the example. Maybe I'd just set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand what this mean, can you elaborate more ? |
||
* patient_age: calculateAge(state.data.properties.birthdate), | ||
* })) | ||
* ); | ||
* @example <caption>Inserting patitent data with custom transformations. (v1 and v2)</caption> | ||
mtuchi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* each( | ||
* "$.data[*]", | ||
* insert("patient", (state) => ({ | ||
* patient_name: state.data.properties.case_name, | ||
* patient_id: state.data.case_id, | ||
* })) | ||
* ); | ||
* @param {DataSource} dataSource - JSONPath referencing a point in `state`. | ||
* @param {Operation} operation - The operation needed to be repeated. | ||
* @returns {Operation} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to specify v1 and v2 rules here? That might create more confusion that it solves, and I don't think we have any active in-development projects on v1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$.data is lazy state loading and it doesn't work in v1. So i am bit worried there. I am not sure when officially we are going shutdown v1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V1 will keep running for ages, but no-one is writing new jobs on it. Check with Aleksa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paging @aleksa-krolls 🔔Can we document stuff that won't work on v1?
I think we should be focusing our docs on V2. I also think talking about v1 and V2 is confusing for users. V1 of what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josephjclark I agree that we should focus the docs on v2... so no need to say
Only in v2
as that should be assumed.That said, I do think it's okay to document when an old example is from
from/supported in openfn v1
... because this helps our team and v1 users understand why old job code may look different than what they're seeing on the latest docs. But I'll leave this up to you and @mtuchi to decide.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good steer, thanks. I'll double check this and see if I want to flag anything before merging, although I suspect not in this work