-
Notifications
You must be signed in to change notification settings - Fork 2k
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
add simple JSON pointer parsing to prevent data duplication #1681
Conversation
@ExE-Boss got an opinion? |
Given that this is mainly used for mixins/interfaces, which are implemented by other things, and in many cases, the versions when the mixins were implemented tends to differ from when the features, that are now part of the mixins, were originally implemented on the objects that are now implementing the mixins. Based on that, I believe that the way I described in #813 (comment) would allow us to support the cases where certain objects implemented the mixins at different times. |
@ExE-Boss sure. updated |
This is a very cool idea. Thank you for this PR! |
This happens during loading for EVERY FILE, so it ends up being O(n²), and it happens when the tree hasn’t been fully parsed (eg. we might have loaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this violates the current schema, since $ref
is a valid entry in an identifier
type of type identifier
, which can’t be a string
:
browser-compat-data/schemas/compat-data.schema.json
Lines 112 to 121 in f724e4b
"identifier": { | |
"type": "object", | |
"properties": { | |
"__compat": { "$ref": "#/definitions/compat_statement" } | |
}, | |
"patternProperties":{ | |
"^(?!__compat)[a-zA-Z_0-9-$@]*$" : { "$ref": "#/definitions/identifier" } | |
}, | |
"additionalProperties": false | |
}, |
Doing the following instead would be valid according to the current schema, since "<ref_to_import>"
would be an empty object if it’s identical to the source:
"__import": {
"<ref_to_import>": {
// Override stuff here when necessary.
}
}
I’m currently working on implementing my above thing.
@Elchi3 the object parse takes a couple of ms on my laptop
@ExE-Boss how so? It happens after the result object is completely extended out |
Except that the function Lines 40 to 66 in bc0e12c
|
Right, which means the ref parsing doesn’t occur until after the internal loops have been completed. This is the value that was being exported previously. If that wasn’t the case then the package would output incomplete data today
… On Apr 17, 2018, at 11:57 AM, ExE Boss ***@***.***> wrote:
it happens when the tree hasn’t been fully parsed (eg. we might have loaded api.*s and css.*, but not yet html.* or webextensions.*),
how so? It happens after the result object is completely extended out
Except that the function load calls itself recursively: https://github.com/mdn/browser-compat-data/blob/bc0e12c225f96156ebc5a5c7b3b056cc71f93c29/index.js#L40-L66
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
ping @Elchi3 |
Sorry, reviewing this and the other approach isn't in my priorities at the moment. |
no worries, and thanks for the explanation.
…On Thu, May 3, 2018 at 2:12 AM, Florian Scholz ***@***.***> wrote:
Sorry, reviewing this and the other approach isn't in my priorities at the
moment.
This PR at least needs a schema update and a test in the
test/sample-data.json file so that we can run a basic test against the
implementation. But then again, I'm currently focusing on getting the PR
backlog down and finishing the data migration so we can retire old/static
MDN compat tables. Thanks for your understanding.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1681 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAcaBlMHMparCQtMyyrANI7KUjx1nZ33ks5tusoLgaJpZM4S5uvy>
.
--
patrick
|
Bulk data updates through external sources and scripts are our preferred approach to better compat data right now and we're not currently considering de-duplicating version data. Therefore I'm closing this issue. Thanks for your thoughts here! Maybe we will reconsider this idea at a later stage. |
fixes #813
idea is, given the following
file a.json
and file b.json
then b.json would result in