Skip to content

Fix job writing guide: update examples to current adaptor APIs#806

Open
hunterachieng wants to merge 2 commits into
mainfrom
feature/788-update-job-writing-guide
Open

Fix job writing guide: update examples to current adaptor APIs#806
hunterachieng wants to merge 2 commits into
mainfrom
feature/788-update-job-writing-guide

Conversation

@hunterachieng

@hunterachieng hunterachieng commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Short Description

Updated all code examples in the job writing guide to reflect the current adaptor API. Removed legacy v1 helpers (fields, dataValue, relationship, bulk, etc.) in favour of plain JavaScript objects and arrow functions, fixed deprecated 3-argument operation callbacks to use .then(), and corrected several syntax errors and typos across the guide.

Closes #788

Details

The approach was to go through each file in the job writing guide and compare every code example against the current adaptor docs (salesforce-docs.md, dhis2-docs.md, http-docs.md, openmrs-docs.md, etc.) to verify the APIs being demonstrated still exist and match the current signatures.

The main pattern shift is that v1 adaptors used a set of functional helpers (fields(), dataValue(), relationship()) to build operation arguments, whereas current adaptors accept plain JavaScript objects and arrow functions directly. Most examples needed to be rewritten around this, rather than just tweaked.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to
know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Signed-off-by: Hunter Achieng <achienghunter@gmail.com>

@mtuchi mtuchi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hunterachieng can you also review all job examples or create a sub issue for it, I think we should try to clean up at least the top 5 adaptors

@hunterachieng

Copy link
Copy Markdown
Contributor Author

@mtuchi I checked the adaptor examples and majority are up to date

@mtuchi

mtuchi commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@hunterachieng i meant job examples for each of our adaptor, we mantain couple of examples in our docs
Here are couple of links

See this folder to see all our official job code library we mantain
https://github.com/OpenFn/docs/tree/main/adaptors/library/jobs

Most of these examples contain anti-patterns like writing nested operations, some are just using very old way of mapping

Comment thread docs/jobs/job-snippets.md Outdated
})
fn(state => {
const clean = val =>
val == null ? '' : val.toString().replace(/-/g, ' ');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move clean outside the fn block,
I update

 const clean = val =>
    val === null ? '' : val.toString().replace(/-/g, ' ');

@hunterachieng hunterachieng force-pushed the feature/788-update-job-writing-guide branch from 1ddee10 to 0a6be0f Compare June 19, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Revise all job writing code

2 participants