Rest.li Multi-language Compatibility Matrix
Contents
Following Rest.li Test Suite Specification, we’ve added test suites for Python and Java.
Based on these test suites, we’ve made the following compatibility matrices:
Supported Resources
| Resource |
Java |
Python |
Additional Information |
| ActionSet |
x |
x |
Python requires a top-level “namespace”, which is optional according to Rest.li protocol |
| Association |
x |
|
Python generates code using a template engine, which doesn’t support Association |
| Collection |
x |
x |
Python requires a top-level “namespace”, which is optional according to Rest.li protocol |
| Simple |
x |
x |
Python requires a top-level “namespace”, which is optional according to Rest.li protocol |
Resource Keys and Parameters
| Key Feature |
Java |
Python |
Additional Information |
| Primitive Key |
x |
x |
long |
| Complex Key (Simple Record and Union) |
x |
|
In Java, ComplexResourceKey is a map of complex keys and params. In Python, complex key is supported, but only as a record, not a map with params |
| Query Parameters |
x |
x |
Integer, string, long, string array, message array, string map, primitive union, complex types union, optional string, url typeref |
Supported Data Templates in Test Suite Spec
| Template |
Java |
Python |
Additional Information |
| Array of Maps |
x |
x |
|
| Complex Types |
x |
x |
|
| Defaults |
x |
x |
Test spec provides a schema with default values. In Python, we cannot specify a default value for Fixed field because Python does not support Fixed in the same way as Java. |
| Enums |
x |
x |
|
| Enum with Properties |
x |
x |
|
| Fixed |
x |
|
Python does not support Fixed in the same way as Java |
| Fixed5 |
x |
|
Python does not support Fixed in the same way as Java |
| Includes |
x |
x |
|
| Large Record |
x |
x |
|
| Map of Ints |
x |
x |
|
| MD5 |
x |
x |
|
| Message |
x |
x |
|
| Optionals |
x |
x |
|
| Primitives |
x |
x |
|
| Record with Properties |
x |
x |
|
| Record with Typeref Field |
x |
x |
|
| Time |
x |
x |
|
| Type Defined Before Include |
x |
x |
|
| Type Defined in Include |
x |
x |
|
| Typeref Message |
x |
x |
|
| Typerefs |
x |
x |
Typerefs.pdsc may need a different name in Python to avoid a naming conflict. If the filename is not changed, Python testsuite will have a folder for typeref resources, such as collectionTyperef, and it will also generate typeref.py from Typerefs.pdsc. |
| Union of Complex Types |
x |
x |
|
| Union of Primitives |
x |
x |
|
| Union of Same Types |
x |
x |
|
| Url |
x |
x |
|
| Header |
Java |
Python |
Additional Information |
| Content‑Type: PSON |
x |
|
Java’s content type can be set to JSON, PSON, or any. In Python’s restconstants.py, Content-Type is always set to “application/json”. |
| Accept |
x |
|
Java can specify media accepted (e.g. JSON, or PSON). Python does not use an Accept header, so according to RFC, it is assumed all media types are accepted |
| User‑Agent |
|
x |
This header is optional as per RFC. Java does not use it, while Python uses it |
| X‑RestLi‑Method |
x |
x |
According to Rest.li protocol, X-RestLi-Method is only required for BATCH_CREATE and BATCH_PARTIAL_UPDATE. Java always includes it for all POST requests, and Python uses the header only when required. |
| Request Feature |
Java |
Python |
| Unfilled Optional ActionParams |
If optional ActionParam is not set, it is omitted from the serialized data. |
If optional ActionParam is not set, it is still explicitly set to null in the serialized body. For an example, see the actionset-multiple-inputs-no-optional test, in which Python Rest.li includes “ ‘optionalString’: null” in the request. |
| Scheme and Host Components of URL |
Request URL is relative, scheme and host can be configured in instantiating a RestClient |
URL scheme is hard-coded to http in requesturlbuilders.py, and requests.models.py requires a host |