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

Missing of keyword in protocol action rules leads to confusing error #507

Closed
diehuxx opened this issue Sep 19, 2023 · 2 comments · Fixed by #520
Closed

Missing of keyword in protocol action rules leads to confusing error #507

diehuxx opened this issue Sep 19, 2023 · 2 comments · Fixed by #520
Assignees
Labels
good first issue Good for newcomers hacktoberfest For the hacking month of October

Comments

@diehuxx
Copy link

diehuxx commented Sep 19, 2023

Background:

When a protocol definition has a recipient or author rule, the of keyword is required. But the error that the JSON schema throws is difficult for people to understand. /descriptor/definition/structure/album/$actions/0/who: must be equal to one of the allowed values

Task

We should either alter the JSON schema to throw a friendlier message, or add validation in plain javascript.

JSON Schema: https://github.com/TBD54566975/dwn-sdk-js/blob/main/json-schemas/interface-methods/protocol-rule-set.json#L24-L74

Protocol Definition javascript validation: https://github.com/TBD54566975/dwn-sdk-js/blob/main/src/interfaces/protocols-configure.ts#L44

// correct
[{
  who: 'anyone',
  can: 'read'
},
{
  who: 'recipient',
  of: 'foo',
  can: 'read'
},
{
  who: 'author',
  of: 'foo',
  can: 'read'
}]

// incorrect
[{
  who: 'recipient',
  // missing `of`
  can: 'read'
},
{
  who: 'author',
  // missing `of`
  can: 'read'
},
{
  who: 'anyone',
  of: 'foo', // should not have `of`
  can: 'read'
}]

Picking Up This Issue:

  • If you'd like to work on this, please comment "picking this up" below, and I'll assign the issue to you

Questions:

Resources:

  • Creating a Pull Request: If you're new to GitHub and unsure how to create a pull request, follow this step-by-step guide.

Remember, communication is key! If you have any questions or face any challenges, we're here to help so please don't hesitate to reach out.

Good Luck! 🍁

@diehuxx diehuxx added good first issue Good for newcomers hacktoberfest For the hacking month of October and removed hacktoberfest For the hacking month of October labels Sep 19, 2023
@EbonyLouis EbonyLouis added the hacktoberfest For the hacking month of October label Sep 19, 2023
@flothjl
Copy link
Contributor

flothjl commented Sep 26, 2023

picking this up.

@EbonyLouis
Copy link
Contributor

EbonyLouis commented Sep 28, 2023

@flothjl It's been assigned to you! 🎉

Kudos for submitting your PR so quickly! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest For the hacking month of October
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants