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

Resolve inconsistency between the name parameter used across validation errors #528

Open
4 of 5 tasks
dsleiter opened this issue Mar 1, 2021 · 0 comments
Open
4 of 5 tasks
Labels
category: enhancement improvements of code or code behavior topic: validator issues related to validation of files

Comments

@dsleiter
Copy link
Contributor

dsleiter commented Mar 1, 2021

The docstring for the name parameter of validation errors is "the name of the component that is erroneous". MissingError and MissingDataType validation errors are created when required children of a group are not present (the former when the child does not have an explicit type and the latter when there is a type). For MissingError, the value of name is the path to the child, while for MissingDataType, the value of name is the path to the parent group.

It would be an improvement to resolve this inconsistency across all validation errors.

If a GroupBuilder is missing a required child builder (DatasetBuilder, GroupBuilder, or LinkBuilder), which component is erroneous - the parent GroupBuilder, or the missing child?

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
The name passed to either MissingError or MissingDataType should be changed to be consistent with the other.

The consistency of the name passed to all other validation errors should be evaluated and changed if other inconsistencies are found.

Describe alternatives you've considered
An alternative would be to update the parameter name or documentation to clarify why the existing implementation is correct.

Additional context
See the difference in name_of_erroneous here depending on the error type:

def __construct_missing_child_error(self, child_spec, parent_builder):
"""Returns either a MissingDataType or a MissingError depending on
whether or not a specific data type can be resolved from the spec
"""
data_type = _resolve_data_type(child_spec)
builder_loc = self.get_builder_loc(parent_builder)
if data_type is not None:
name_of_erroneous = self.get_spec_loc(self.spec)
return MissingDataType(name_of_erroneous, data_type,
location=builder_loc, missing_dt_name=child_spec.name)
else:
name_of_erroneous = self.get_spec_loc(child_spec)
return MissingError(name_of_erroneous, location=builder_loc)

Checklist

  • Have you ensured the feature or change was not already reported ?
  • Have you included a brief and descriptive title?
  • Have you included a clear description of the problem you are trying to solve?
  • Have you included a minimal code snippet that reproduces the issue you are encountering?
  • Have you checked our Contributing document?
@dsleiter dsleiter added the category: enhancement improvements of code or code behavior label Mar 1, 2021
@rly rly added the topic: validator issues related to validation of files label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: enhancement improvements of code or code behavior topic: validator issues related to validation of files
Projects
None yet
Development

No branches or pull requests

2 participants