Enrich schema declarations to allow for describing all the details of an API
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
txAWS |
Fix Released
|
Medium
|
Christopher Armstrong |
Bug Description
It'd be nice if schemas made it possible to describe:
- A method's name
- A more rich, abstract description of the arguments that a method takes
- support for list arguments as List("things", Unicode())
- support for structures as Structure(
- the *output* format (assuming json, it can be described as a Structure())
- possible errors (as a list of exception types)
- documentation of the method as a whole in the schema
- documentation of each individual parameter (even structure elements)
Some changes that will need to happen
- all parameter types will need to make the name argument optional, so they can be used as anonymous fields (like in Lists). Parameter types that take an additional positional argument after the name will be changed to accept those arguments as keywords, so you'd do something like Enum(mapping=...), but the old Enum('name', mapping) will still work.
- the way that indexing in arguments is done is INCREDIBLY INSANE. Every other element in a "foo.bar.baz.quux" field is assumed to be a list index. This will need to change, (since it doesn't allow for things like Structure("foo", fields=
Let's double-check the Colander library to see if it has any good ideas to use.
Related branches
- Chad Smith (community): Approve
- Thomas Herve: Approve
-
Diff: 917 lines (+524/-168)3 files modifiedtxaws/server/schema.py (+307/-158)
txaws/server/tests/test_resource.py (+2/-1)
txaws/server/tests/test_schema.py (+215/-9)
- Jerry Seutter (community): Approve
- Alberto Donato (community): Approve
-
Diff: 333 lines (+192/-24)2 files modifiedtxaws/server/schema.py (+66/-22)
txaws/server/tests/test_schema.py (+126/-2)
Changed in txaws: | |
assignee: | nobody → Christopher Armstrong (radix) |
Changed in txaws: | |
importance: | Undecided → Medium |
status: | New → In Progress |
Changed in txaws: | |
status: | In Progress → Fix Released |