Browse Source

Add extended swagger info to all CRUD operations

Maurits van der Schee 8 years ago
parent
commit
2697d1e36e
1 changed files with 18 additions and 0 deletions
  1. 18
    0
      api.php

+ 18
- 0
api.php View File

@@ -1769,6 +1769,15 @@ class PHP_CRUD_API {
1769 1769
 							if ($k>0) echo ',';
1770 1770
 							echo '"'.$field.'": {';
1771 1771
 							echo '"type": "string"';
1772
+							if (isset($action['fields'][$field]->referenced)) {
1773
+								echo ',"x-referenced": '.json_encode($action['fields'][$field]->referenced);
1774
+							}
1775
+							if (isset($action['fields'][$field]->references)) {
1776
+								echo ',"x-references": '.json_encode($action['fields'][$field]->references);
1777
+							}
1778
+							if (isset($action['fields'][$field]->primaryKey)) {
1779
+								echo ',"x-primary-key": true';
1780
+							}
1772 1781
 							echo '}';
1773 1782
 						}
1774 1783
 						echo '}'; //properties
@@ -1816,6 +1825,15 @@ class PHP_CRUD_API {
1816 1825
 							if ($k>0) echo ',';
1817 1826
 							echo '"'.$field.'": {';
1818 1827
 							echo '"type": "string"';
1828
+							if (isset($action['fields'][$field]->referenced)) {
1829
+								echo ',"x-referenced": '.json_encode($action['fields'][$field]->referenced);
1830
+							}
1831
+							if (isset($action['fields'][$field]->references)) {
1832
+								echo ',"x-references": '.json_encode($action['fields'][$field]->references);
1833
+							}
1834
+							if (isset($action['fields'][$field]->primaryKey)) {
1835
+								echo ',"x-primary-key": true';
1836
+							}
1819 1837
 							echo '}';
1820 1838
 						}
1821 1839
 						echo '}'; //properties

Loading…
Cancel
Save