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

Demonstrative Example #572

Closed
wants to merge 3 commits into from
Closed

Conversation

Vinit-Pandit
Copy link
Contributor

README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
README.markdown Outdated Show resolved Hide resolved
Signed-off-by: Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
Signed-off-by: Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
@Vinit-Pandit
Copy link
Contributor Author

Vinit-Pandit commented Apr 25, 2024

weird previously CI is fail with this errors
"E: Failed to fetch https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease' is no longer signed."

@Vinit-Pandit Vinit-Pandit requested a review from jviotti April 26, 2024 15:32
@jviotti
Copy link
Member

jviotti commented Apr 26, 2024

Probably an issue on GitHub Actions. It should fix itself!

@@ -6,6 +6,42 @@ standards such as [JSON Schema](http://json-schema.org), [JSON
Pointer](https://www.rfc-editor.org/rfc/rfc6901),
[JSONL](https://jsonlines.org), and more.

Example
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need this, mainly if its not really a title. Maybe just end the above paragraph with "For example:"?

// Updating the value of the name using JSON pointer
sourcemeta::jsontoolkit::set(document, name_pointer, name_value);
sourcemeta::jsontoolkit::prettify(document, std::cout);
std::cout<<"\n";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
std::cout<<"\n";
std::cout << "\n";

Be mindful of style!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😅 It's going to take me some time to develop such detailed styled practices.

Copy link
Member

Choose a reason for hiding this comment

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

We all went through it :) Overall, attention to detail is super, super important in software engineering

std::cout<<"\n";

// The above program will print the following to standard output:
//output :
Copy link
Member

Choose a reason for hiding this comment

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

There is no space between // and output here. In any case, I don't think you need to say "output :" here if the above sentence always says that the program will print the following to standard output

// The above program will print the following to standard output:
//output :
// {
// "address": "zxy_with_bar",
Copy link
Member

Choose a reason for hiding this comment

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

Also, there is a mismatch between this and the actual example above

// A new JSON document for the name
const sourcemeta::jsontoolkit::JSON name_value{"Johnny Doe"};
// Updating the value of the name using JSON pointer
sourcemeta::jsontoolkit::set(document, name_pointer, name_value);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
sourcemeta::jsontoolkit::set(document, name_pointer, name_value);
sourcemeta::jsontoolkit::set(document, {"name"}, new_value);

I think inlining the JSON Pointer looks cooler from an example point of view

sourcemeta::jsontoolkit::parse(R"JSON({
"name": "John Doe",
"age": 20,
"address": "zxy"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe put a short semi-real address? I guess you can generate a supposedly valid i.e. US address on Google

sourcemeta::jsontoolkit::prettify(document, std::cout);
std::cout<<"\n";

// The above program will print the following to standard output:
Copy link
Member

Choose a reason for hiding this comment

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

Now that I see this again, I wonder if you should do this AFTER the code block. i.e. after showing the C++ program, write on the README: "The above program will print the following to standard output:", then open a new JSON code block, and put the output?

#include <iostream>

int main() {
// Creating JSON using parse
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Creating JSON using parse
// Parsing a JSON document


int main() {
// Creating JSON using parse
sourcemeta::jsontoolkit::JSON document =
Copy link
Member

Choose a reason for hiding this comment

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

On the README we likely have more horizontal space, so you can format this a bit nicer:

sourcemeta::jsontoolkit::JSON document = sourcemeta::jsontoolkit::parse(R"JSON({
  "name": "John Doe",
  "age": 20,
  "address": "zxy"
})JSON");

Copy link
Member

Choose a reason for hiding this comment

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

@tony-go It'd have been so cool to have #506 here 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I do bad dreams because of this hahaha :)

@@ -22,3 +58,5 @@ long the outcome is distributed under the same license. Otherwise, you must
obtain a [commercial license](./LICENSE-COMMERCIAL) that removes such
restrictions. Read more about our licensing approach
[here](https://www.sourcemeta.com/licensing/).

Copy link
Member

Choose a reason for hiding this comment

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

This blank lines should go away

@jviotti
Copy link
Member

jviotti commented Jul 15, 2024

I imported your commits and fixed the remaining comments here: #845. Thanks!

@jviotti jviotti closed this Jul 15, 2024
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