File tree Expand file tree Collapse file tree 5 files changed +37
-5
lines changed
Expand file tree Collapse file tree 5 files changed +37
-5
lines changed Original file line number Diff line number Diff line change 1919 'options ' => [
2020 'route ' => '/documentation[/:api[-v:version][/:service]] ' ,
2121 'constraints ' => [
22- 'api ' => '[a-zA-Z][a-zA-Z0-9_.]+ ' ,
22+ 'api ' => '[a-zA-Z][a-zA-Z0-9_.% ]+ ' ,
2323 ],
2424 'defaults ' => [
2525 'controller ' => Controller::class,
Original file line number Diff line number Diff line change @@ -102,10 +102,10 @@ public function createApi($apiName, $apiVersion = 1)
102102 $ api ->setName ($ apiName );
103103
104104 $ serviceConfigs = [];
105- if ($ this ->config ['zf-rest ' ]) {
105+ if (! empty ( $ this ->config ['zf-rest ' ]) ) {
106106 $ serviceConfigs = array_merge ($ serviceConfigs , $ this ->config ['zf-rest ' ]);
107107 }
108- if ($ this ->config ['zf-rpc ' ]) {
108+ if (! empty ( $ this ->config ['zf-rpc ' ]) ) {
109109 $ serviceConfigs = array_merge ($ serviceConfigs , $ this ->config ['zf-rpc ' ]);
110110 }
111111
@@ -407,6 +407,10 @@ private function getField(array $fieldData)
407407 $ field ->setFieldType ($ fieldData ['field_type ' ]);
408408 }
409409
410+ if (isset ($ fieldData ['example ' ])) {
411+ $ field ->setExample ($ fieldData ['example ' ]);
412+ }
413+
410414 $ required = isset ($ fieldData ['required ' ]) ? (bool ) $ fieldData ['required ' ] : false ;
411415 $ field ->setRequired ($ required );
412416
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ class Field implements IteratorAggregate
3636 */
3737 protected $ fieldType = '' ;
3838
39+ /**
40+ * @var string
41+ */
42+ protected $ example ;
43+
3944 /**
4045 * @param string $name
4146 */
@@ -116,6 +121,18 @@ public function setFieldType($fieldType)
116121 $ this ->fieldType = $ fieldType ;
117122 }
118123
124+ public function getExample ()
125+ {
126+ return $ this ->example ;
127+ }
128+
129+ public function setExample ($ example )
130+ {
131+ $ this ->example = $ example ;
132+
133+ return $ this ;
134+ }
135+
119136 /**
120137 * Cast object to array
121138 *
@@ -127,6 +144,7 @@ public function toArray()
127144 'description ' => $ this ->description ,
128145 'required ' => $ this ->required ,
129146 'type ' => $ this ->fieldType ,
147+ 'example ' => $ this ->example ,
130148 ];
131149 }
132150
Original file line number Diff line number Diff line change @@ -19,10 +19,15 @@ class AgAcceptHeaders extends AbstractHelper
1919 */
2020 public function __invoke (Service $ service )
2121 {
22+ $ requestAcceptTypes = $ service ->getRequestAcceptTypes ();
23+ if (empty ($ requestAcceptTypes )) {
24+ $ requestAcceptTypes = [];
25+ }
26+
2227 $ view = $ this ->getView ();
2328 $ types = array_map (function ($ type ) use ($ view ) {
2429 return sprintf ('<div class="list-group-item">%s</div> ' , $ view ->escapeHtml ($ type ));
25- }, $ service -> getRequestAcceptTypes () );
30+ }, $ requestAcceptTypes );
2631 return implode ("\n" , $ types );
2732 }
2833}
Original file line number Diff line number Diff line change @@ -19,10 +19,15 @@ class AgContentTypeHeaders extends AbstractHelper
1919 */
2020 public function __invoke (Service $ service )
2121 {
22+ $ requestContentTypes = [];
23+ if (!empty ($ service ->getRequestContentTypes ())) {
24+ $ requestContentTypes = $ service ->getRequestContentTypes ();
25+ }
26+
2227 $ view = $ this ->getView ();
2328 $ types = array_map (function ($ type ) use ($ view ) {
2429 return sprintf ('<div class="list-group-item">%s</div> ' , $ view ->escapeHtml ($ type ));
25- }, $ service -> getRequestContentTypes () );
30+ }, $ requestContentTypes );
2631 return implode ("\n" , $ types );
2732 }
2833}
You can’t perform that action at this time.
0 commit comments