- autopep8 for automatic code formatting
Generated server code use these libraries:
- Flask or Sanic as web framework
- python jsonschema for request body validation
- python-jose for JWT decoding
Generated client library use requests or aiohttp as http library.
RAML Object is mapped to python class
RAML Enum become python enum as described in https://docs.python.org/3/library/enum.html
Except for builtin types, generated server use python-jsonschema for request body validation.
Validation | Status |
---|---|
minLength | v |
maxLength | v |
pattern | v |
minimum | v |
maximum | v |
format | x |
multipleOf | v |
array field minItems | v |
array field maxItems | v |
array field uniqueItems | x |
array Type minItems | x |
array Type maxItems | x |
array Type uniqueItems | x |
Request and response body are mapped into structs and following the same rules as types.
struct name = [Resource name][Method name][ReqBody|RespBody].
Resources in the server are mapped to:
- a flask blueprint module
The generated server contains a handlers directory, the python handlers files are the only files that are not overwritten by a regeneration. Each api method has a generated handler file, this is where the user should add the implementation for each method.
Resourcess in the client are implemented as services.
Let's say we have two root resources:
- /users
- /network
Client library is going to have two services:
- users
- network
Each service will have it's own methods
Code related to Requests Headers are only generated in the Client lib. All functions have arguments to send any request header, the current client lib will not check the headers against the RAML specifications.
All client library functions have arguments to send query strings and query Parameters, the current client lib will not check it against the RAML specifications.
Resource Types and Traits already parsed by the parser. So, the generator need to know nothing about it.
go-raml only supports OAuth2.0.
- client : it currently able to get oauth2 token with client credentials.
- server : it currently only support JWT token from itsyou.online
Includes should work properly
Libraries should work properly except the apidocs web page (REST UI).