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

127 compare header and schema #146

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

Conversation

PietrH
Copy link
Member

@PietrH PietrH commented Aug 3, 2023

No description provided.

@PietrH PietrH linked an issue Aug 3, 2023 that may be closed by this pull request
6 tasks
@PietrH PietrH added the enhancement New feature or request label Aug 3, 2023
@PietrH PietrH added this to the 1.1.0 milestone Aug 3, 2023
@PietrH
Copy link
Member Author

PietrH commented Aug 3, 2023

check_schema() fails on case mismatch between schema and data. To replicate:

# create package with the wrong case in the schema of observations
  wrong_case_in_schema_pkg <- example_package
  ## change case
  purrr::pluck(wrong_case_in_schema_pkg, "resources", 2, "schema", "fields") <-
    purrr::chuck(wrong_case_in_schema_pkg, "resources", 2, "schema", "fields") %>%
    purrr::map2_chr(
      c(TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE), #set some to upper, some to lower case
      ~ ifelse(.y,
        toupper(purrr::chuck(.x, "name")),
        tolower(purrr::chuck(.x, "name"))
      )
    )
read_resource(wrong_case_in_schema_pkg, "observations")

Fails on:

# Check fields have names
field_names <- purrr::map_chr(fields, ~ replace_null(.x$name, NA_character_))

Error in `purrr::map_chr()` at frictionless-r/R/check_schema.R:20:2:
ℹ In index: 1.
Caused by error in `.x$name`:
! $ operator is invalid for atomic vectors
Run `rlang::last_trace()` to see where the error occurred.

@peterdesmet peterdesmet removed this from the 1.1.0 milestone Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compare header and schema
2 participants