Skip to content

Conversation

@tojump
Copy link
Contributor

@tojump tojump commented Dec 24, 2022

As the name indicates this PR adds examples to the object schemas.

The example were collected and adapted manually from the various Chia RPC docs, so there is the potential for some inaccuracies but from a quick review I didn't spot anything obviously wrong.

Similarly the https://www.npmjs.com/package/yaml parsing modified the formatting slightly.

@tojump
Copy link
Contributor Author

tojump commented Dec 24, 2022

Note that I didn't commit the updated docs folder as I am not certain of the procedure for building.

Copy link
Owner

@dkackman dkackman left a comment

Choose a reason for hiding this comment

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

This is great! I am looking through them.

Can you let me know what the annotate-with-example.zx.mjs does and add comments to the top of that file?

@tojump
Copy link
Contributor Author

tojump commented Dec 24, 2022

Can you let me know what the annotate-with-example.zx.mjs does and add comments to the top of that file?

It's the script I used to insert examples into the existing schemas.
We can use it by piping the example data corresponding to the given schema file. For instance:

cat <<EOF | ./tools/annotate-with-example.zx.mjs src/schemas/network_info.yaml
{
    "network_name": "mainnet",
    "network_prefix": "xch",
    "success": true
}
EOF

It doesn't necessarily need to be committed because it doesn't need to be run again, but I included it for documentation purposes and in the case where we wanted to tweak the output or feed a different example.

@dkackman
Copy link
Owner

Can you let me know what the annotate-with-example.zx.mjs does and add comments to the top of that file?

It's the script I used to insert examples into the existing schemas. We can use it by piping the example data corresponding to the given schema file. For instance:

cat <<EOF | ./tools/annotate-with-example.zx.mjs src/schemas/network_info.yaml
{
    "network_name": "mainnet",
    "network_prefix": "xch",
    "success": true
}
EOF

It doesn't necessarily need to be committed because it doesn't need to be run again, but I included it for documentation purposes and in the case where we wanted to tweak the output or feed a different example.

Makes sense. Will add this to the top of that file for reference.

@tojump
Copy link
Contributor Author

tojump commented Dec 24, 2022

Makes sense. Will add this to the top of that file for reference.

Ah, I just committed something like that 🙂

@dkackman dkackman merged commit dff61ae into dkackman:main Dec 24, 2022
@dkackman
Copy link
Owner

These are published. Been wanting to incorporate something like this for awhile. Thank you!

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.

2 participants