From 0d3abcafa466904d4e7376d8b877cf88869b4228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9rov=C3=A9e=20Charrue?= Date: Wed, 17 Apr 2019 18:05:57 +0200 Subject: [PATCH] doc: add clarity to spec definition in README --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 393a507..3927f2a 100644 --- a/README.md +++ b/README.md @@ -114,13 +114,21 @@ At the end in the controller, you will have true json, xml for payload & integer ### Automatic binding route -**RREST** bind the route to a controller by following this convention: +**RREST** binds the route to a controller by following this convention: * `POST /item/` -> `Controllers\Item#postAction` * `GET /item/{itemId}/` -> `Controllers\Item#getAction` * `GET /item/{itemId}/comment` -> `Controllers\Item\Comment#getAction` * `PUT /item/{itemId}/comment/{commentId}` -> `Controllers\Item\Comment#putAction` -> note you can define the controller namespace (here Controllers) in the RREST\RREST constructor +> Note: You can define the controller namespace (here Controllers) in the RREST\RREST constructor + +> Note: Currently, the order of API definitions matters. See this as an example : +> ```raml +> /item/{itemId} +> /item/archive +> ``` +> Calling `GET /item/archive` will be matched to the first endpoint, with value "archive" for {itemId}. +> To prevent this, simply order endpoint definitions. ### Response