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

feat: ✨ add simple helper functions #962

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

martonvago
Copy link
Contributor

@martonvago martonvago commented Jan 10, 2025

Description

This PR adds some simple helper functions that will be used when running more complex checks in Sprout.

As a rule, I tried to write simple checks in such a way that they only check a single thing. So if a function checks whether a field is blank, it won't fail if the field is missing or is of the wrong type, because there are separate checks for that. That said, it's always possible to argue that this doesn't make sense for some functions -- so feel free to argue if you think any checks should behave differently!

This PR needs an in-depth review.

Checklist

  • Added or updated tests
  • Updated documentation
  • Ran just run-all

@martonvago martonvago self-assigned this Jan 10, 2025
@martonvago martonvago changed the title feat: ✨ add simple helper functions feat: ✨ add simple helper functions [2/7] Jan 10, 2025
@martonvago martonvago marked this pull request as ready for review January 10, 2025 23:20
@martonvago martonvago requested a review from a team as a code owner January 10, 2025 23:20
Copy link
Member

@signekb signekb left a comment

Choose a reason for hiding this comment

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

Still loving the smaller PRs 👌 🌟

Co-authored-by: Signe Kirk Brødbæk <[email protected]>
signekb
signekb previously approved these changes Jan 15, 2025
Copy link
Member

@signekb signekb left a comment

Choose a reason for hiding this comment

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

🌟

Base automatically changed from feat/sprout-checks-1-required-fields to main January 20, 2025 08:45
@lwjohnst86 lwjohnst86 dismissed signekb’s stale review January 20, 2025 08:45

The base branch was changed.

@lwjohnst86 lwjohnst86 changed the title feat: ✨ add simple helper functions [2/7] feat: ✨ add simple helper functions Jan 20, 2025
Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

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

Very nice! Just some small comments and suggestions 😁

@@ -3,8 +3,10 @@
get_json_path_to_resource_field,
)

CHECKS_TYPE_ERROR_MESSAGE = "{field_value} is not of type '{field_type}'"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could arguably go into a separate file or even be exposed by the checks package. As #978 will rework this, I'll just leave it like this for now.

@martonvago martonvago requested a review from lwjohnst86 January 20, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants