Changes between and of Initial VersionVersion 9Ticket #5532


Ignore:
Timestamp:
03/26/2013 02:45:21 PM (6 years ago)
Author:
teratorn
Comment:

I've addressed all the review comments in the current branch. My eyes can't pick out any more coding standards violations, but that doesn't mean I caught them all..

I've changed the proposed JSON format such that Command names are top-level keys under the "commands" key. This seems more natural to me (thanks dreid), and should map more cleanly to formats like YAML where indentation indicates structure.

Ready for review.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5532

    • Property Keywords review added
    • Property Owner teratorn deleted
    • Property Branch changed from to branches/amp-json-spec-5532-2
    • Property Author changed from to teratorn
  • Ticket #5532 – Description

    initial v9  
    55An example of the proposed format:
    66{{{
    7 {"commands" : [{"name"      : "Sum",
    8                 "arguments" : [["a", "Integer"],
    9                                ["b", "Integer"]],
    10                 "responses" : [["total", "Integer"]]
     7{"commands" : {
     8    "Sum" : {
     9        "arguments" : [["a", "Integer"],
     10                       ["b", "Integer"]],
     11        "response"  : [["total", "Integer"]]
     12            },
     13
     14    "Divide" : {
     15        "arguments" : [["numerator", "Float"],
     16                       ["denominator", "Float"]],
     17        "response"  : [["result", "Float"]],
     18           
     19        "errors"    : [["ZERO_DIVISION", "ZeroDivisionError"]]
     20               },
     21
     22    "SumList" : {
     23        "arguments" : [["args", {"type" : "ListOf", "of" : "Integer"}],
     24                       ["basevalue", {"type" : "Integer",
     25                                      "optional" : true}]
     26                      ],
     27        "response"  : [["total", "Integer"]]
    1128                },
    1229
    13                {"name"      : "Divide",
    14                 "arguments" : [["numerator", "Float"],
    15                                ["denominator", "Float"]],
    16                 "responses" : [["result", "Float"]],
    17            
    18                 "errors"    : [["ZERO_DIVISION", "ZeroDivisionError"]]
    19                 },
    20 
    21                {"name"      : "SumList",
    22                 "arguments" : [["args", {"type" : "ListOf", "of" : "Integer"}],
    23                                ["basevalue", {"type" : "Integer", "optional" : true}]
    24                               ],
    25                 "responses" : [["total", "Integer"]]
    26                 },
    27 
    28                {"name"      : "SumPairs",
    29                 "arguments" : [["args", {"type" : "TupleList", "of" : ["Integer", "Integer"]}]],
    30                 "responses" : [["total", "Integer"]]
    31                 }
    32               ]
     30    "SumPairs" : {
     31        "arguments" : [["args", {"type" : "TupleList",
     32                                 "of" : ["Integer", "Integer"]}]],
     33        "response"  : [["total", "Integer"]]
     34                 }
     35    }
    3336}
    34 
    3537}}}
    3638
     
    4042class Sum(amp.Command):
    4143    arguments = [['a', amp.Integer()], ['b', amp.Integer()]]
    42     responses = [['total', amp.Integer()]]
     44    response  = [['total', amp.Integer()]]
    4345   
    4446class Divide(amp.Command):
    4547    arguments = [['numerator', amp.Float()],
    4648                 ['denominator', amp.Float()]]
    47     responses = [['result', amp.Float()]]
     49    response  = [['result', amp.Float()]]
    4850    errors    = [['ZERO_DIVISION', ZeroDivisionError]]
    4951
     
    5254                 ['basevalue', amp.Integer(optional=True)]]
    5355
    54     responses = [['total', amp.Integer()]]
     56    response = [['total', amp.Integer()]]
    5557       
    5658class SumPairs(amp.Command):
    5759    arguments = [['args', TupleList(amp.Integer(), amp.Integer())]]
    58     responses = [['total', amp.Integer()]]
     60    response  = [['total', amp.Integer()]]
    5961
    6062}}}