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

Fix 1635 unexpected missing label error when ignoring header case #1638

Conversation

amelie-rondot
Copy link
Contributor

@amelie-rondot amelie-rondot commented Feb 5, 2024


This PR fixes unexpected missing-label error in validation report which occurs when validating tabular data in this specific case: The data contains a named column corresponding to a required fieldin the schema used for validation, written without respecting case-sensitivity.
For example:

data = [["aa", "BB"], ["a", "b"]]
schema = {
        "$schema": "https://frictionlessdata.io/schemas/table-schema.json",
        "fields": [
            {"name": "AA", "constraints": {"required": True}},
            {"name": "bb", "constraints": {"required": True}}
        ]
    }

This PR adds some test cases:

  • one test case to ensure that validating this tabular data with this schema and using schema_sync=True and dialect=Dialect(header_case=False) options, returns a valid report.
  • one test case to ensure that if validation is case-sensitive, if a name column does not respect case a missing-label occurs in validation report.
  • another test case to ensure that validating with missing required column "AA" with this schema and using schema_sync=True and dialect=Dialect(header_case=False) options, returns an invalid report with missing-label error related to field "AA".

Finally, I suggest some refactoring in this PR:

  • refactoring removing missing required label from field info refactoring removing missing required label from field info
  • refactoring creating schema fields among labels part when using schema_sync option in detect_schema() Detector method

@amelie-rondot amelie-rondot marked this pull request as ready for review February 5, 2024 17:16
@amelie-rondot amelie-rondot marked this pull request as draft February 6, 2024 09:04
@amelie-rondot amelie-rondot marked this pull request as ready for review February 6, 2024 10:21
@amelie-rondot
Copy link
Contributor Author

This PR is replaced by PR#1641

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.

Unexpected "missing-label" error with option header_case = False
1 participant