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

Parser: Support multiple attribute type, reject invalid #10338

Merged
merged 7 commits into from Oct 4, 2018

Conversation

Projects
None yet
4 participants
@aduth
Member

aduth commented Oct 4, 2018

Blocker for: #9634

This pull request seeks to enhance the block parser to support multiple type, in accordance with JSON schema. This is planned to be used in #9634 to support a nullable string for align attribute, representable in JSON schema as multiple type [ "string", "null" ].

In doing so, it needs to account for how to handle existing behavior of attribute value casting, necessary for attributes sourced ambiguously as strings (e.g. as HTML attribute values). With these changes, casting only occurs for ambiguous string sources of a singular attribute type. For any other attribute, we now reject the attribute value (adopting behavior as if undefined, accounting for default value). This may be considered a breaking change, but only in cases where values were assigned of the wrong type, relying on casting to correct. More often, this should help capture unintended serialization (e.g. objects serialized as casted string [object Object]).

Testing instructions:

Verify unit tests pass.

npm test
@youknowriad

LGTM 👍

aduth added some commits Oct 4, 2018

Parser: Deprecate type coercion
It's unclear for which string sources should be considered ambiguous and allow casting, in addition to being inconsistently enforced. Rather than defaulting to leniency, we should enforce the type broadly, reintroducing leniency later if noted issues and need for multiple type support can be reconciled.

@aduth aduth merged commit 413ac1a into master Oct 4, 2018

2 checks passed

codecov/project 49.29% (+0.07%) compared to 37bd1e6
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@aduth aduth deleted the update/parser-reject-invalid-type branch Oct 4, 2018

@mtias mtias added this to the 4.0 milestone Oct 9, 2018

@aduth aduth referenced this pull request Oct 17, 2018

Merged

Ensure cite is string when merging quote #10678

0 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment