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 handling of unknown values for known property names #155

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

lee-m
Copy link
Contributor

@lee-m lee-m commented Jun 4, 2023

When the option to ignore unknown values was turned on, unknown values were not being stored in the parsed properties as UnknownProperty was only being used when an unknown property name was found, not an unknown value for a known property.

To handle this, we need to split the logic around unknown properties into two. Firstly, if we see an unknown property name then we instantiate an UnknownProperty instance, but if we find a known property that we can't set the value on (TrySetValue returns false), we need to convert that property to an UnknownProperty instance and call TrySetValue on it again.

This requires a bunch of changes to unit test expectations since there are some tests that use very liberal parsing options for allowing unknown properties, unknown values etc. and due to everything being stored internally as UnknownProperty before (which will accept any value), some of the expected values for things like colours/short-hands etc. were out of date and failing.

When the option to ignore unknown values was turned on, unknown values
were not being stored in the parsed properties as UnknownProperty was
only being used when an unknown property name was found, not an unknown
value for a known property.

To handle this, need to split the logic around unknown property into two
- firstly, if we seen an unknown property name then we instantiate an
UnknownProperty instance, but we if find a known property that we
can't set the value on (TrySetValue returns false), we need to convert
that property to an UnknownProperty instance and re-set the value on
it.
@TylerBrinks TylerBrinks merged commit a1c71d8 into TylerBrinks:master Jul 6, 2023
@lee-m lee-m deleted the unknown-value-fix branch July 6, 2023 14:04
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.

2 participants