23andMe / Yamale

A schema and validator for YAML.
MIT License
681 stars 89 forks source link

Fix cornercase with dots in key name #51

Closed supertylerc closed 5 years ago

supertylerc commented 5 years ago

Fixes #50. See that issue for my stream of failures in figuring out how to fix the issue. I'm not quite sure exactly what causes it to fail, but for some reason there we reach a point where the . doesn't get replaced with a _. It only seems to happen when the value of the dotted key is a dict (maybe other non-scalars are affected as well?).

supertylerc commented 5 years ago

Knew this would happen. I'll fix the merge conflicts tomorrow.

supertylerc commented 5 years ago

Merge conflicts fixed.

supertylerc commented 5 years ago

@blopker, what do you think about this one? Do you prefer to solve it in another way?

supertylerc commented 5 years ago

bump @blopker ?

blopker commented 5 years ago

Hey, I'm on vacation right now, I'll check this out soon!

On Tue, Mar 26, 2019, 11:07 PM Tyler Christiansen notifications@github.com wrote:

bump @blopker https://github.com/blopker ?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/23andMe/Yamale/pull/51#issuecomment-476659115, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuO_8zLvFabAP4POxfRmaajVzocQfTSks5vaimMgaJpZM4b3aLb .

vmiklos commented 5 years ago

I just hit this; could you please merge this and tag a new release please? Thanks.

mildebrandt commented 5 years ago

Thank you for your interest and your PR. This fix doesn't cover the, very contrived, schema and doc here:

items:
  one.two: int()
  one_two: str()
items:
  one_two: "1"
  one.two: 1

This fails with items.one_two: '1' is not a str. There may be other cases that are less contrived that would also fall into this category.

We're going to go in another direction and fix the separator used to flatten the keys, which will avoid the need to change the key names at all during processing.