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

Fix ID types to match JSON-RPC 2.0 spec #569

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

lifeofpavs
Copy link
Contributor

@lifeofpavs lifeofpavs commented Oct 17, 2024

Updating description of id key according to JSON -RPC 2.0 Specification

id
An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]
The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.

[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.

[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.

Problem

id key definition possible values are not correctly specified in the docs

Summary of Changes

Add correct description for the values

Fixes #

updating description of id key according to [`JSON  RPC 2.0` standard](https://www.jsonrpc.org/specification#request_object)
@mikemaccana mikemaccana changed the title Update index.mdx Fix ID types to match JSON-RPC 2.0 spec Oct 17, 2024
@mikemaccana
Copy link
Collaborator

Good catch @lifeofpavs !

  • I removed integer as JSON doesn't have integers, just IEEE numbers, as the spec mentions.
  • Can you add something like 'should be a string or integer, or in rare cases may be null' or something else that captures what the spec says about null?
  • Why is this a draft PR?

Copy link
Collaborator

@mikemaccana mikemaccana left a comment

Choose a reason for hiding this comment

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

See comments above.

docs/rpc/http/index.mdx Outdated Show resolved Hide resolved
@lifeofpavs
Copy link
Contributor Author

Good catch @lifeofpavs !

  • I removed integer as JSON doesn't have integers, just IEEE numbers, as the spec mentions.
  • Can you add something like 'should be a string or integer, or in rare cases may be null' or something else that captures what the spec says about null?
  • Why is this a draft PR?

Hey @mikemaccana ! Sure, will do. I started doing it and wanted to review it again before marking it ready for review. Thanks for the comments! Will update ASAP

Updating description based on specification
@lifeofpavs lifeofpavs marked this pull request as ready for review October 18, 2024 10:32
@lifeofpavs
Copy link
Contributor Author

@mikemaccana updated!

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. Remove stale label or comment or this will be closed in 7 days.

@nickfrosty nickfrosty merged commit 6c5b4cd into solana-foundation:main Nov 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants