Skip to content
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

Functions schema validation failure in v11.0.0 #375

Closed
EtienneLem opened this issue May 18, 2021 · 6 comments · Fixed by #376
Closed

Functions schema validation failure in v11.0.0 #375

EtienneLem opened this issue May 18, 2021 · 6 comments · Fixed by #376

Comments

@EtienneLem
Copy link

EtienneLem commented May 18, 2021

Bug Description

Trying to upgrade to v11.0.0, we’re now getting schema validation errors.

Here’s an example of the error messages we’re getting:

App.creates.draft.operation.inputFields[17].key
inputField keys must be unique for each action. The key "undefined" is already in use at creates.draft.operation.inputFields[16].key

App.creates.draft.operation.inputFields[18].key
inputField keys must be unique for each action. The key "undefined" is already in use at creates.draft.operation.inputFields[16].key

Looking at the schema docs and the validation implementation of #347, it feels like it might not be handling the cases of functions? Validation takes for granted that key is required, but if my understanding of the schema is correct, FunctionSchema does not require a key.

Reproduction Steps

These key-less fields are functions. Both async and sync fails the validation. Our inputFields are typically structured like this:

const getField = (z, bundle) => {
  return {
    key: 'c',
    children: [{ key: 'c1' }, { key: 'c2' }],
  }
}

const getDynamicField = async (z, bundle) => {
  if (!bundle.inputData.someData) {
    return []
  }

  const fields = await fetchFields()
  return [
    {
      key: 'd',
      fields
    }
  ]
}

const inputFields = [
  { key: 'a' },
  { key: 'b' },
  getField,
  getDynamicField,
]

Here it would probably fail when validating getDynamicField because "undefined" is already in use at inputFields[2].

Version Info

  • Version info: 11.0.0
  • Operating System: macOS (arm64)
  • App id: 129003 (not publicly available yet)
@zapzap
Copy link
Collaborator

zapzap commented May 18, 2021

This issue has been copied into our private issue tracker (as PDE-2410). Thanks for the report! We'll update this as we learn more.

@xavdid
Copy link
Contributor

xavdid commented May 18, 2021

Great find! I'll get that shored up. In the meantime, you can downgrade zapier-platform-core to the 10.x line or skip validation until it's fixed.

@xavdid
Copy link
Contributor

xavdid commented May 19, 2021

The fix is merged and it'll go out in the next release sometime in the next few weeks. Thanks for the report!

@EtienneLem
Copy link
Author

Great! Thanks for the super quick turnaround 🤘🏼

@xavdid
Copy link
Contributor

xavdid commented May 28, 2021

@EtienneLem this is released with core@11.0.1, available now.

@EtienneLem
Copy link
Author

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants