using-refs.json 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "title": "Example of using references in swagger-php",
  5. "version": "1.0.0"
  6. },
  7. "paths": {
  8. "/products/{product_id}": {
  9. "get": {
  10. "tags": [
  11. "Products"
  12. ],
  13. "responses": {
  14. "default": {
  15. "$ref": "#/responses/product"
  16. }
  17. }
  18. },
  19. "patch": {
  20. "tags": [
  21. "Products"
  22. ],
  23. "parameters": [
  24. {
  25. "$ref": "#/parameters/product_in_body"
  26. }
  27. ],
  28. "responses": {
  29. "default": {
  30. "$ref": "#/responses/product"
  31. }
  32. }
  33. },
  34. "parameters": [
  35. {
  36. "$ref": "#/parameters/product_id_in_path_required"
  37. }
  38. ]
  39. },
  40. "/products": {
  41. "post": {
  42. "tags": [
  43. "Products"
  44. ],
  45. "parameters": [
  46. {
  47. "$ref": "#/parameters/product_in_body"
  48. }
  49. ],
  50. "responses": {
  51. "default": {
  52. "$ref": "#/responses/product"
  53. }
  54. }
  55. }
  56. }
  57. },
  58. "definitions": {
  59. "Product": {
  60. "properties": {
  61. "id": {
  62. "description": "The unique identifier of a product in our catalog.",
  63. "type": "integer",
  64. "format": "int64"
  65. },
  66. "status": {
  67. "$ref": "#/definitions/product_status"
  68. }
  69. }
  70. },
  71. "product_status": {
  72. "description": "The status of a product",
  73. "type": "string",
  74. "default": "available",
  75. "enum": [
  76. "available",
  77. "discontinued"
  78. ]
  79. }
  80. },
  81. "parameters": {
  82. "product_id_in_path_required": {
  83. "name": "product_id",
  84. "in": "path",
  85. "description": "The ID of the product",
  86. "required": true,
  87. "type": "integer",
  88. "format": "int64"
  89. },
  90. "product_in_body": {
  91. "name": "product",
  92. "in": "body",
  93. "schema": {
  94. "$ref": "#/definitions/Product"
  95. }
  96. }
  97. },
  98. "responses": {
  99. "product": {
  100. "description": "All information about a product",
  101. "schema": {
  102. "$ref": "#/definitions/Product"
  103. }
  104. },
  105. "todo": {
  106. "description": "This API call has no documentated response (yet)"
  107. }
  108. }
  109. }