Hi All
Currently we are facing broken use cases related to URI Templates in API
Manager. It is a result of two main problems.
1. Issues related to URI Template implementation in synapse.
2. lack of URI Template support in Swagger.
Following are the identified issues.
1. If we define URI Template as a resource if you need to support optional
query parameters we need to add "*".
ex:- /users/{userId}* If you define /users/{userId} it will not qualify
"/users/12?query=param".
2. Like above if you add * to support query parameters it will give away to
sub paths
ex:- /users/{userId}* would qualify /users/12/invalid/path.
3. According to spec (*) cannot be used alone it has to be used with an
expression refer spec [1].
4. Swagger only support a minor subset of URI Template that is via path
parameters. ( Ex /users/{user} ). Find a discussion about URI Template
support in swagger here [2]. So if we define an unsupported URITemplate in
a resource it will break the swagger console and other swagger tooling.
Following are some solutions we can consider for the mention issues.
1. Change the URITemplate implementation to accept optional query
parameters by default ( without adding "*" ) unless it is specially
restricted by query expression [3]
2. If the first issue is fixed second issue will not arise.
3. Removing * to be spec complaint will break the existing users. but we
can add wild card support through expressions in to URITemplate
Implementation.
4. Support full URI Templates in ESB and only support what is supported in
swagger in API Manager.
Please share your thoughts.
Thanks & Regards
Jo
PS: RFC6570 reference implementation can be found [4] and test cases can be
found [5]
[1] https://tools.ietf.org/html/rfc6570
[2]
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/swagger-workgroup/uzy-GBHv1vc/pPTSfh8OBtUJ
[3] https://tools.ietf.org/html/rfc6570#section-3.2.8
[4] https://github.com/uri-templates/uritemplate-py
[5] https://github.com/uri-templates/uritemplate-test
--
*Joseph Fonseka*
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware
mobile: +94 772 512 430
skype: jpfonseka
* <http://lk.linkedin.com/in/rumeshbandara>*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture