poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JSON Representation


From: Jose E. Marchesi
Subject: Re: JSON Representation
Date: Wed, 06 May 2020 17:20:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

    

Hi kostasch!
Thanks for the update.
    
    diff --git a/libpoke/pvm-val.json b/libpoke/pvm-val.json
    index 98d37d5d..b7ea3633 100644
    --- a/libpoke/pvm-val.json
    +++ b/libpoke/pvm-val.json
    @@ -1,24 +1,44 @@
     {
         "$schema": "http://json-schema.org/draft-06/schema#";,
         "$id": "",
    -    "title" : "PVMValuesRepresentation",
    -    "description" : "JSON Representation for PVM values",
    +    "title" : "Poke values",
    +    "description" : "JSON Representation for Poke values",
         "definitions" : {
    -        "Integral": {
    +            "UnsignedInteger" : {
    +                    "type" : "object",
    +                    "properties" : {
    +                            "value" : {
    +                                    "type" : "integer",
    +                                    "minimum" : 0
    +                            },
    +                            "size" : {
    +                                    "type" : "UnsignedInteger",
    +                                    "maximum" : 4294967295
    +                            }
    +                    },

For unsigned integers:

The minimum for "value" should be 0.
The maximum for "value" should be 2^64 -1.

The "size" is in bits, so:
The minimum for "size" should be 1.
The maximum for "size" should be 64.


    +                 "required": [
    +                "size",
    +                "value"
    +            ],
    +            "title": "UnsignedInteger"
    +            },
    +        "Integer": {
                 "type": "object",
                 "properties": {
                     "value": {
                         "type": "integer"
                     },
    -                "size": {
    -                    "type": "integer"
    +                "size" : {
    +                        "type" : "UnsignedInteger",
    +                        "maximum" : 4294967295
                     }
                 },
                 "required": [
                     "size",
                     "value"
                 ],
    -            "title": "Integral"
    +            "title": "Integer"
             },

For signed integers:

The minimum for "value" should be -2^32-1 (please double check, I always
get these things wrong :)).

The maximum for "value" should be.. 2^32-1? (ditto!)

             "Null": {
                 "type": "object",
    @@ -35,16 +55,21 @@
             "Offset": {
                 "type": "object",
                 "properties": {
    -                "identifier": {
    -                    "type": "string"
    +                "magnitude": {
    +                    "type": "integer",
    +                    "oneOf" : [
    +                            {"type" : "UnsignedInteger"},
    +                            {"type" : "Integer"}
    +                    ]
                     },
    -                "size": {
    -                    "type": "integer"
    +                "base": {
    +                    "type": "UnsignedInteger",
    +                    "maximum" : 9223372036854775807
                     }
                 },

Nope...

"magnitude" should be either an "Integer" or an "UnsignedInteger" JSON
object.

"base" should be an "UnsignedInteger" JSON object with "size" == 64
bits.

I hope that is representable in this JSON schema thingie... :)

                 "required": [
    -                "identifier",
    -                "size"
    +                "magnitude",
    +                "base"
                 ],
                 "title": "Offset"
             },



reply via email to

[Prev in Thread] Current Thread [Next in Thread]