solana-foundation / developer-content

Collection of Developer content for exploring, learning, and building in the Solana ecosystem.
https://solana.com/developers
143 stars 273 forks source link

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

Closed lifeofpavs closed 5 days ago

lifeofpavs commented 1 month ago

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 #

mikemaccana commented 1 month ago

Good catch @lifeofpavs !

lifeofpavs commented 1 month ago

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

lifeofpavs commented 1 month ago

@mikemaccana updated!

github-actions[bot] commented 6 days ago

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.