Skip to content

Comments

Fix ignoring schema when wildcard-key is defined#142

Merged
whatyouhide merged 1 commit intodashbitco:mainfrom
florius0:fix-star
Apr 5, 2025
Merged

Fix ignoring schema when wildcard-key is defined#142
whatyouhide merged 1 commit intodashbitco:mainfrom
florius0:fix-star

Conversation

@florius0
Copy link
Contributor

@florius0 florius0 commented Apr 4, 2025

Currently, schemas with wildcard-key defined misbehave:

iex(1)> NimbleOptions.validate [], [table: [doc: "ETS table to use", type: :atom, default: nil], *: [type: :any]]
{:ok, []}
iex(2)> NimbleOptions.validate [], [table: [doc: "ETS table to use", type: :atom, default: nil]]
{:ok, [table: nil]}

The reason is that NimbleOptions.expand_star_to_option_keys/2 ignores all other keys, except present in the data when handling wildcard.

Is that intended?

@josevalim
Copy link
Member

Yeah, I feel it should be [table: nil] for both, right @whatyouhide?

@coveralls
Copy link

Pull Request Test Coverage Report for Build e7ed4c95ea219a988286bc04378fe70620abab1a-PR-142

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.793%

Totals Coverage Status
Change from base Build 19f7b2409832fade7541c576cfae03bd57b8a871: 0.0%
Covered Lines: 272
Relevant Lines: 290

💛 - Coveralls

Copy link
Collaborator

@whatyouhide whatyouhide left a comment

Choose a reason for hiding this comment

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

Yes I think this is a great change, I'd consider it a bug fix 🙃 Thank you @florius0 💟

@whatyouhide whatyouhide merged commit 23becbe into dashbitco:main Apr 5, 2025
2 checks passed
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.

4 participants