Commit graph

72 commits

Author SHA1 Message Date
Richard van der Hoff
838af2a23e Updates to swagger table generation
A bunch of related fixes to the code for parsing the state and API yaml files:

1. Some of our objects are {key: {key: value}} - style nested key/value
   dictionaries. Handle this by refactoring get_json_schema_object_fields so
   that such objects are handled wherever they appear, rather than when they
   are just subproperties of a 'proper' object.

2. Fix multi-level inheritance (so an object can have an 'allOf' property which
   can successfully refer to an object which itself has an 'allOf' property).

3. $ref fields in event schemas weren't being expanded correctly

4. sort type tables breadth-first rather than depth-first so that the ordering
   in complex structures like the /sync response makes a bit more sense.
2015-11-15 23:44:46 +00:00
Daniel Wagner-Hall
e72151f2c3 Specify guest room access
This was reviewed as PR #150 and merged from daniel/anonymousaccess
2015-11-06 18:15:21 +00:00
Mark Haines
8070489080 Handle lists of types in arrays 2015-11-04 11:44:20 +00:00
Mark Haines
e49ea9015f Deduplicate tables with the same title 2015-11-04 11:39:36 +00:00
Mark Haines
8322151661 Don't put a space when appending the "Must be" strings to the desciption if there isn't a description, otherwise it will mess up the indent 2015-11-03 19:42:49 +00:00
Mark Haines
91eb25b76d Include the full schema for an http API in the docs by resolving references to other files 2015-10-30 15:45:46 +00:00
Mark Haines
71874870c8 Enable syntax highlighting for example http requests 2015-10-26 17:25:33 +00:00
Kegan Dougal
30d46a19d5 Review comments 2015-10-26 14:01:27 +00:00
Kegan Dougal
3b7585cbda Make nested request objects display correctly (search API)
This now displays search_categories.room_events.filter and co correctly.
Also make arrays of enums display correctly.
2015-10-26 11:17:19 +00:00
Kegan Dougal
f95d19cecd Merge branch 'master' into appservice-swagger
Conflicts:
	specification/application_service_api.rst
2015-10-21 09:55:53 +01:00
Kegan Dougal
bbd3f8072c Review comments 2015-10-19 13:28:44 +01:00
Kegan Dougal
d39a9082a0 Add invite_room_state to spec. Flesh out info. 2015-10-16 16:43:33 +01:00
Kegan Dougal
f20faa80e5 Swagger validation 2015-10-15 14:58:00 +01:00
Daniel Wagner-Hall
2502ca7ac6 Merge branch 'master' into daniel/threepidinvites-2
Conflicts:
	specification/targets.yaml
2015-10-12 18:11:01 +01:00
Kegan Dougal
f2a6950cc3 Minor tweaks; allow objects without props/parents if a title is set
This allows us to do things like {Tweaks} where Tweaks is defined somewhere
else.
2015-10-08 16:21:26 +01:00
Daniel Wagner-Hall
21a40b317d Merge branch 'master' into daniel/threepidinvites-2 2015-10-08 09:41:17 -05:00
Kegan Dougal
65504db7bb Display nested keys on arrays of objects. Make it valid swagger. 2015-10-08 13:40:21 +01:00
Kegan Dougal
31ae4b3859 Swaggerify push notification API
Edit units.py to support nested JSON request keys
2015-10-08 13:08:21 +01:00
Kegan Dougal
a9618a981b Swaggerify the /enabled endpoint 2015-10-08 11:16:42 +01:00
Kegan Dougal
56ce432399 Get profile tag keys displaying correctly. 2015-10-08 10:14:05 +01:00
Kegan Dougal
c5edc60c4c Add push YAML for pushers endpoint.
Also display "required" text on required JSON body request params. Also
increase the size of the request param column to support longer param names
present in the pushers API.
2015-10-07 16:01:36 +01:00
Kegan Dougal
09ac367847 Merge branch 'master' into module-content-repo
Conflicts:
	templating/matrix_templates/units.py
2015-10-02 10:46:46 +01:00
Kegan Dougal
4dabcd112e Remove redundant info now we have the http api template. Minor tweaks to display of schema with no names but a type 2015-10-02 10:44:50 +01:00
Daniel Wagner-Hall
d2c56fb7a3 Merge branch 'master' into daniel/threepidinvites-2 2015-10-01 21:18:50 -05:00
Kegan Dougal
87b6dd845e Flesh out content repo; modify templating to support headers
Edit content-repo.yaml to include examples and headers.
Restructure content module to conform to the module template.
Adjust the HTTP API template to give 1 more char to the response
param to fit "Content-Disposition" correctly.
Edit the templating system to support displaying enums for
swagger APIs (before it was just JSON schema). Also add support
for introspecting headers from swagger. Finally, replace - with
_ when forming the {{ template_var }} else things whine.
2015-10-01 17:55:16 +01:00
Kegan Dougal
560cd7a58f This isn't javascript. s/,/%/ 2015-10-01 15:54:45 +01:00
Kegan Dougal
c972dad8b3 Flesh out receipts module. Add receipts swagger
Add templating support for v2 apis.
2015-10-01 15:41:54 +01:00
Kegan Dougal
365a9076b9 Add nested dict template support; Add x-pattern
For cases where event schema specify `patternProperties` it would be nice
to give that pattern a "human-readable" form rather than a raw regex. This
is now supported by specifying `x-pattern` in the value part of the specified
pattern e.g. `patternProperties:{ "^.*":{ x-pattern: "$THING", ... } }`

Templating had limited record type descriptions limited to value primitives
e.g. `{string: integer}`. It now supports inspecting the values recursively
if the value is `object`.

Updated `m.receipt` to take both these points into account to make it read
better. Tweak receipt module text.
2015-10-01 12:11:26 +01:00
Kegan Dougal
6afdfc0771 Add more logging and make logging context clearer
This is now actually useful if you want to debug why your swagger YAML
isn't producing a table you think it should be.
2015-09-23 15:36:13 +01:00
Kegan Dougal
b0eb985523 Merge branch 'master' into spec-restructure-modules 2015-09-22 16:04:41 +01:00
Kegan Dougal
056b5eba22 Partially handle representing top-level array responses
If an HTTP API returned a top-level array response, the templating system
would fail to create a table for it. This is now partially fixed by pulling
out the type of the elements (no recursion is done to populate nested tables)
2015-09-22 16:01:22 +01:00
Kegan Dougal
f71763b0d3 Implement relative title styles
Templates don't know at what level they will be inserted. Previously, we
hard-coded the title style which is not compatible with the build target
system. Define a set of styles which will be replaced by the gendoc script
when it encounters them:
 '<' : Make this title a sub-heading
 '/' : Make this title a heading at the same level
 '>' : Make this title a super-heading

The build target system is now basically complete and functioning.
2015-09-22 13:08:15 +01:00
Mark Haines
f33c0846c3 Merge remote-tracking branch 'origin/master' into markjh/document_v1_rooms_api 2015-09-18 17:38:03 +01:00
Mark Haines
7c2ccb1aeb Merge remote-tracking branch 'origin/master' into markjh/swagger_examples 2015-09-18 16:11:26 +01:00
Mark Haines
7ac5c3766c Merge remote-tracking branch 'origin/master' into markjh/event-schema
Conflicts:
	templating/matrix_templates/units.py
2015-09-18 15:49:36 +01:00
Mark Haines
f99a38ce72 Update the hard-coded paths in templating units.py.
Replace the hard code paths with global variables.
2015-09-18 14:43:57 +01:00
Mark Haines
63f08bace6 Fix the examples in the swagger API documentation to be valid JSON 2015-09-18 14:40:48 +01:00
Mark Haines
7f81501762 Allow relative references to schema to work in python and node.
Rename "schema/v1/core" to "schema/v1/core-event-schema".
Add self-referential symlinks to schema/v1/core-event-schema

The python json schema libraries expect that relative references are
relative to the file they are in. The node json schema libraries
expect that relateive references are relative to the first file loaded.

To support both kinds we reference the core event schema using
"core-event-schema/event.json". We then symlink the core-event-schema
directory to both the location of the file refering to "event.json" so
that it will work in python and to the location of the top level file
so that it will work in node.
2015-09-18 11:39:44 +01:00
Kegan Dougal
5b59c67510 Minor formatting fixes. Fix state event templating. 2015-09-17 16:34:20 +01:00
Mark Haines
315f97e36b Merge branch 'master' into markjh/document_v1_rooms_api 2015-09-17 15:25:00 +01:00
Mark Haines
380f186273 Log which file a json parse error occurred in 2015-09-17 14:42:43 +01:00
Mark Haines
2cf8da6b20 Update the gendoc script to load the core event schema from
separate files.
2015-09-17 10:28:57 +01:00
Mark Haines
7eb8b4fde2 Add new-style docs for the APIs for getting events for a room 2015-09-15 15:52:36 +01:00
Daniel Wagner-Hall
c66a933640 Merge branch 'master' into daniel/threepidinvites-2 2015-09-10 16:47:50 +01:00
Daniel Wagner-Hall
306f91edb3 Specify third party room invitations
SYN-458
2015-09-10 16:46:22 +01:00
Kegsay
3011823c51 Merge pull request #27 from matrix-org/receipts
Document receipts
2015-09-10 16:18:19 +01:00
Daniel Wagner-Hall
d399e5b93b Use an alias object rather than flat fields 2015-09-09 13:16:46 +01:00
Kegan Dougal
a92fa6392d Include patternProperties as normal properties (they basically are just patterns instead of keys; we could probably annotate this more nicely in the future) 2015-09-08 17:14:31 +01:00
Daniel Wagner-Hall
64cfc00f50 Remove unused fluff 2015-09-08 17:07:52 +01:00
Daniel Wagner-Hall
90f5dc370b Populate aliases from canonical endpoint
Swagger validates badly if you have endpoints without the full
specification of things, so instead let's generate them the other way
around.
2015-09-08 16:59:18 +01:00