Skip to content

Fix variable in recursive normalization #234

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

Merged
merged 1 commit into from
Sep 13, 2020
Merged

Fix variable in recursive normalization #234

merged 1 commit into from
Sep 13, 2020

Conversation

naglis
Copy link
Contributor

@naglis naglis commented Sep 12, 2020

At 7.4.1 step 9.a.i, if normalized is a list containing item map, e.g.:

[
    {
        "type": [
            "Person"
        ],
        "name": "Herman Melville"
    }
]

it seems that context for the recursive normalize data call should be item["type"], not keyValue["item"]. In this case, context would be Person.

Same applies for step 9.b.i.

It appears item["type"] is being used in the reference implementation:

var obj_context = getContext(normalized[i]);


Preview | Diff

At 7.4.1 step 9.a.i, if `normalized` is a list containing `item` map, e.g.:

```json
[
    {
        "type": [
            "Person"
        ],
        "name": "Herman Melville"
    }
]
```

it seems that context for the recursive normalize data call should be `item["type"]`, not `keyValue["item"]`. In this case, context would be `Person`.

Same applies for step 9.b.i.

It appears `item["type"]` is being used in the reference implementation:

https://github.com/w3c/pub-manifest/blob/9a17073f65c5bae1e120933a9676250016b70148/experiments/manifest-to-internal-processor/manifestProcessor.js#L624
@iherman
Copy link
Member

iherman commented Sep 13, 2020

Marked as non substantive for IPR from ash-nazg.

Copy link
Member

@iherman iherman left a comment

Choose a reason for hiding this comment

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

It is difficult for me to 100% judge this based on my implementation (because it is in Typescript, the concept of "type" is more implicit based on the typing feature of TS), but I believe the proposed changes are indeed right.

@mattgarrish
Copy link
Member

Looks right to me.

In 9.a.1, keyValue is the value of the key, so unless it's a map with a type it doesn't make any sense. It's the type of map that is sent in with each key/value pair. Same with 9.b.1.

@mattgarrish mattgarrish merged commit 6993343 into w3c:master Sep 13, 2020
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.

3 participants