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

Enhance error reporting and handling for large JSON validations #505

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

NiklasA
Copy link

@NiklasA NiklasA commented Nov 17, 2024

Pull request for issue: #443

  • Tests pass
  • ruff format
  • README.md updated (if relevant)
  •  CHANGELOG.md entry added

@NiklasA NiklasA marked this pull request as draft November 17, 2024 18:42
@NiklasA
Copy link
Author

NiklasA commented Nov 17, 2024

@pascalrosenberger / @ManbirP / @hirschsebastian could please review the PR, before I will change the status from draft to finish?

logging.info("Validating JSON")
for json_obj in json_stream:

def get_primary_key_field(schema: dict, model_name: str) -> str:

Choose a reason for hiding this comment

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

Since primary_key_field can be theoretically None, I suggest to set as a return type Optional[str].

return primary_key_field


def get_primary_key_value(schema: dict, model_name: str, json_object: dict) -> str:

Choose a reason for hiding this comment

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

Since the return value can be theoretically None, I suggest to set as a return type Optional[str].

model=exception.model,
engine=exception.engine,
message=exception.message,
)

Choose a reason for hiding this comment

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

Since we use a property message here, I suggest to add the property to the Check class as Optional[str].

Copy link

@hirschsebastian hirschsebastian left a comment

Choose a reason for hiding this comment

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

In three parts of the code I suggest adding Optional[str] to make the possibility of None more explicit. What do you think?

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 this pull request may close these issues.

2 participants