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

Migrates to json-event-parser #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Tpt
Copy link
Contributor

@Tpt Tpt commented Aug 31, 2022

Makes bindings parsing work really in streaming

@Tpt
Copy link
Contributor Author

Tpt commented Aug 31, 2022

The CI should work when json-event-parser is released

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2993246318

  • 0 of 89 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 2993136441: 0.0%
Covered Lines: 126
Relevant Lines: 126

💛 - Coveralls

@coveralls
Copy link

coveralls commented Sep 5, 2022

Pull Request Test Coverage Report for Build 3180161106

  • 28 of 28 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 3000779580: 0.0%
Covered Lines: 66
Relevant Lines: 66

💛 - Coveralls

package.json Outdated Show resolved Hide resolved
@rubensworks
Copy link
Owner

@Tpt Is this ready for review? Or just for initial testing of the new lib, and only to be used upon first stable release?

@Tpt
Copy link
Contributor Author

Tpt commented Sep 5, 2022

@Tpt Is this ready for review? Or just for initial testing of the new lib, and only to be used upon first stable release?

Yes, it should be ready for review.

Copy link
Owner

@rubensworks rubensworks left a comment

Choose a reason for hiding this comment

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

Nice work!
Just some general questions on where everything should be located.

@surilindur could you test this version on your end to see if it fixes comunica/comunica#1052 and #42 (in the jQuery widget without polyfills)?

@@ -96,6 +96,17 @@ describe('SparqlJsonParser', () => {
`)))).toEqual([]);
});

it('should convert a slightly invalid empty SPARQL JSON response (common PHP error)', async () => {
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this slightly invalid? (looks valid to me at first glance)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the "bindings" key value should be an array and not an object.

lib/JsonStreamQueryTransformer.ts Outdated Show resolved Hide resolved
lib/JsonStreamQueryTransformer.ts Outdated Show resolved Hide resolved
@surilindur
Copy link
Contributor

surilindur commented Oct 3, 2022

I am sorry, I completely forgot this!

With the changes here, I could no longer reproduce comunica/comunica#1052. The Buffer polyfill could also be removed (for issue #42) by bumping the version of readable-stream in json-event-parser to ^4.2.0.

@Tpt
Copy link
Contributor Author

Tpt commented Oct 3, 2022

@surilindur Amazing news! Thank you!

@rubensworks Do you want to release a new beta of json-event-parser to allow me to update this PR with the new JsonStreamQueryTransformer implementation?

@rubensworks
Copy link
Owner

Done! Released v1.0.0-beta.2.

Makes bindings parsing work really in streaming
@Tpt
Copy link
Contributor Author

Tpt commented Oct 4, 2022

@rubensworks Thank you! I have updated the PR to use the beta 2.

Copy link
Owner

@rubensworks rubensworks left a comment

Choose a reason for hiding this comment

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

Nice! This one should be ready to merge then, once json-event-parser is out of beta.

@@ -32,6 +32,7 @@
"devDependencies": {
"@types/jest": "^28.0.0",
"@types/minimist": "^1.2.0",
"@types/readable-stream": "^2.3.14",
Copy link
Owner

Choose a reason for hiding this comment

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

I guess this one should be added as non-dev dep to json-event-parser.

Copy link
Contributor Author

@Tpt Tpt Oct 10, 2022

Choose a reason for hiding this comment

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

Not sure it's required. json-event-parser works from plain JS projects without needing @types/readable-stream. What do you think about it?

Copy link
Owner

Choose a reason for hiding this comment

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

The convention in TS is that typings packages are included as non-dev deps, so that downstream users don't have to include all of these typing packages manually (which can incur in a lot of overhead for many transitive deps). And since typings packages are usually very small, this is not a problem for non-TS projects.

Copy link
Contributor Author

@Tpt Tpt Oct 11, 2022

Choose a reason for hiding this comment

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

@LuisAverhoff
Copy link

Is there anything left to be done to get the json-event-parser package out of beta?

@Tpt
Copy link
Contributor Author

Tpt commented Oct 10, 2022

@LuisAverhoff Not much. I believe it's good to go as a MVP. At worst we can easily push a 2.0.

@rubensworks
Copy link
Owner

I believe it's good to go as a MVP. At worst we can easily push a 2.0.

Do ping me when you think it's good to go :-)

@Tpt
Copy link
Contributor Author

Tpt commented Oct 11, 2022

I believe it's good to go as a MVP. At worst we can easily push a 2.0.

Do ping me when you think it's good to go :-)

I believe that when comunica/json-event-parser.js#2 is merged, the codebase should be ready to be released.

@rubensworks
Copy link
Owner

@Tpt Great!

Before we release, could you look into configuring coveralls in GH Actions, and a badge in the readme (see some of my other repos as example)?

I also see coverage is not 100% yet. Would it be feasible to bump this to 100%?

Does the current implementation cover all of the requirements of rubensworks/jsonld-streaming-parser.js#76? (it's ok if this is not the case if this is planned for a next version, we just have to keep backwards-compat in mind then)

@Tpt
Copy link
Contributor Author

Tpt commented Oct 12, 2022

Before we release, could you look into configuring coveralls in GH Actions, and a badge in the readme (see some of my other repos as example)?
I also see coverage is not 100% yet. Would it be feasible to bump this to 100%?

Sure, working on it. I'm also going to make the parser validates the JSON a bit more carefully to avoid bad surprises (very invalid numbers...).

Does the current implementation cover all of the requirements of rubensworks/jsonld-streaming-parser.js#76? (it's ok if this is not the case if this is planned for a next version, we just have to keep backwards-compat in mind then)

I think so. The basic parser seems to be working. I might just have to write some utilities on top of it but they are likely to be layers on top of the JsonEventParser instead of modifications of it.

@rubensworks
Copy link
Owner

I think so. The basic parser seems to be working. I might just have to write some utilities on top of it but they are likely to be layers on top of the JsonEventParser instead of modifications of it.

Nice :-)

Would be good to have some test in the JSON-LD parser repo to validate this.
E.g., the creation of an infinite JSON-LD stream, piping it into the JSON-LD streaming parser (in streaming mode), and inspecting that memory usage should remain constant (until the script is manually terminated).

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.

5 participants