Skip to content

Conversation

@sejalpunwatkar
Copy link

This change introduces a new ValidationReport dataclass to provide a structured representation of NWB validation results. Instead of returning raw validation errors alone, validation now returns report objects containing contextual metadata while preserving existing validation behavior.

This change introduces a new ValidationReport dataclass to provide a structured representation of NWB validation results. Instead of returning raw validation errors alone, validation now returns report objects containing contextual metadata while preserving existing validation behavior.
]

@dataclass
class ValidationReport:
Copy link
Contributor

@oruebel oruebel Feb 7, 2026

Choose a reason for hiding this comment

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

Could you please add a docstring for the ValidationReport calss and its functions/parameters

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I’ll add docstrings for the ValidationReport class and its methods/parameters.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces a ValidationReport dataclass intended to provide a structured representation of NWB validation results (including metadata like path/namespace/timestamp) rather than returning only raw validation errors.

Changes:

  • Added a new ValidationReport dataclass and exported it via __all__.
  • Updated validation flow to construct and return ValidationReport objects per namespace validated.
  • Updated the validate docval return description to refer to validation “reports”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return validation_errors
io.close()

return validation_reports
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

_validate_single_file now returns a list of ValidationReport objects, which changes the public validate() return value from a flat list of error strings to report objects. This is a breaking API change and also breaks internal consumers that assume a list of strings (e.g., src/pynwb/testing/testh5io.py uses "\n".join(errors) and src/pynwb/validation_cli.py treats len(val_errors)>0 as “has errors”). To preserve existing behavior, keep validate() returning the original flat list of error strings by default and introduce reports behind a new API (e.g., validate(..., return_reports=True) or a separate validate_with_report() function), or otherwise update all in-repo call sites and deprecation notes accordingly.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@rly thoughts on this suggestion by Copilot

Comment on lines +28 to +30
errors: list
created_at: str = field(default_factory=lambda: datetime.utcnow().isoformat())

Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

ValidationReport uses errors: list and created_at: str with datetime.utcnow().isoformat(), which produces a timezone-naive timestamp string and loses type information for consumers. Consider using precise typing for errors (e.g., List[str] if these are error strings) and storing created_at as a timezone-aware datetime (or, if you need a string, use datetime.now(timezone.utc).isoformat() and include the UTC offset).

Copilot uses AI. Check for mistakes.
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