routing.schema.json 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema#",
  3. "title": "Symfony Routing Configuration",
  4. "description": "Defines the application's URL routes, including imports and environment-specific conditionals.",
  5. "type": "object",
  6. "patternProperties": {
  7. "^[a-zA-Z0-9_.-]+$": {
  8. "oneOf": [
  9. { "$ref": "#/$defs/routeDefinition" },
  10. { "$ref": "#/$defs/routeImport" },
  11. { "$ref": "#/$defs/routeAlias" }
  12. ]
  13. },
  14. "^when@.+$": {
  15. "$ref": "#",
  16. "description": "A container for routes that are only loaded in a specific environment (e.g., 'when@dev')."
  17. }
  18. },
  19. "additionalProperties": false,
  20. "$defs": {
  21. "routeDefinition": {
  22. "type": "object",
  23. "properties": {
  24. "path": {
  25. "oneOf": [
  26. { "type": "string" },
  27. { "type": "object", "patternProperties": { "^.+$": { "type": "string" } }, "additionalProperties": false }
  28. ],
  29. "description": "The URL path or a map of locale=>path for localized routes."
  30. },
  31. "controller": {
  32. "type": "string",
  33. "description": "The controller that handles the request, e.g., 'App\\Controller\\BlogController::show'."
  34. },
  35. "methods": {
  36. "description": "The HTTP method(s) this route matches.",
  37. "oneOf": [
  38. { "type": "string" },
  39. { "type": "array", "items": { "type": "string" } }
  40. ]
  41. },
  42. "requirements": {
  43. "type": "object",
  44. "description": "Regular expression constraints for path parameters.",
  45. "additionalProperties": { "type": "string" }
  46. },
  47. "defaults": { "type": "object" },
  48. "options": { "type": "object" },
  49. "host": {
  50. "oneOf": [
  51. { "type": "string" },
  52. { "type": "object", "patternProperties": { "^.+$": { "type": "string" } }, "additionalProperties": false }
  53. ]
  54. },
  55. "schemes": {
  56. "oneOf": [
  57. { "type": "string" },
  58. { "type": "array", "items": { "type": "string" } }
  59. ]
  60. },
  61. "condition": { "type": "string" },
  62. "locale": { "type": "string" },
  63. "format": { "type": "string" },
  64. "utf8": { "type": "boolean" },
  65. "stateless": { "type": "boolean" },
  66. "deprecated": {
  67. "type": "object",
  68. "properties": {
  69. "package": { "type": "string" },
  70. "version": { "type": "string" },
  71. "message": { "type": "string" }
  72. },
  73. "required": ["package", "version"],
  74. "additionalProperties": false
  75. }
  76. },
  77. "required": ["path"],
  78. "additionalProperties": false
  79. },
  80. "routeImport": {
  81. "type": "object",
  82. "properties": {
  83. "resource": {
  84. "description": "Path to the resource to import (commonly a string or {path, namespace}), array of paths, or custom value for loaders (additional properties allowed for extensions).",
  85. "oneOf": [
  86. { "type": "string" },
  87. { "type": "array", "items": { "type": "string" } },
  88. {
  89. "type": "object",
  90. "properties": {
  91. "path": { "type": "string", "description": "The directory path to the resource." },
  92. "namespace": { "type": "string", "description": "The namespace of the controllers in the imported resource (e.g., 'App\\Availability\\UserInterface\\Api')." }
  93. },
  94. "required": ["path"],
  95. "additionalProperties": true
  96. }
  97. ]
  98. },
  99. "type": {
  100. "type": "string",
  101. "description": "The type of the resource (e.g., 'attribute', 'annotation', 'yaml')."
  102. },
  103. "prefix": {
  104. "oneOf": [
  105. { "type": "string" },
  106. { "type": "object", "patternProperties": { "^.+$": { "type": "string" } }, "additionalProperties": false }
  107. ],
  108. "description": "A URL prefix to apply to all routes from the imported resource."
  109. },
  110. "name_prefix": {
  111. "type": "string",
  112. "description": "A name prefix to apply to all routes from the imported resource."
  113. },
  114. "requirements": { "type": "object", "additionalProperties": { "type": "string" } },
  115. "defaults": { "type": "object" },
  116. "options": { "type": "object" },
  117. "host": {
  118. "oneOf": [
  119. { "type": "string" },
  120. { "type": "object", "patternProperties": { "^.+$": { "type": "string" } }, "additionalProperties": false }
  121. ]
  122. },
  123. "schemes": {
  124. "oneOf": [
  125. { "type": "string" },
  126. { "type": "array", "items": { "type": "string" } }
  127. ]
  128. },
  129. "condition": { "type": "string" },
  130. "trailing_slash_on_root": { "type": "boolean" },
  131. "methods": { "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] },
  132. "locale": { "type": "string" },
  133. "format": { "type": "string" },
  134. "utf8": { "type": "boolean" },
  135. "exclude": { "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] },
  136. "stateless": { "type": "boolean" },
  137. "controller": { "type": "string" }
  138. },
  139. "required": ["resource"],
  140. "additionalProperties": false
  141. },
  142. "routeAlias": {
  143. "type": "object",
  144. "properties": {
  145. "alias": { "type": "string" },
  146. "deprecated": {
  147. "type": "object",
  148. "properties": {
  149. "package": { "type": "string" },
  150. "version": { "type": "string" },
  151. "message": { "type": "string" }
  152. },
  153. "required": ["package", "version"],
  154. "additionalProperties": false
  155. }
  156. },
  157. "required": ["alias"],
  158. "additionalProperties": false
  159. }
  160. }
  161. }