Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.44 KB | None | 0 0
  1. const Enjoi = require("enjoi");
  2.  
  3. const gmapsObject = Enjoi.schema({
  4. type: "object",
  5. required: ["results", "status"],
  6. properties: {
  7. results: {
  8. $id: "#/properties/results",
  9. type: "array",
  10. title: "The Results Schema",
  11. items: {
  12. $id: "#/properties/results/items",
  13. type: "object",
  14. title: "The Items Schema",
  15. required: [
  16. "address_components",
  17. "formatted_address",
  18. "geometry",
  19. "place_id",
  20. "types"
  21. ],
  22. properties: {
  23. address_components: {
  24. $id: "#/properties/results/items/properties/address_components",
  25. type: "array",
  26. title: "The Address_components Schema",
  27. items: {
  28. $id:
  29. "#/properties/results/items/properties/address_components/items",
  30. type: "object",
  31. title: "The Items Schema",
  32. required: ["long_name", "short_name", "types"],
  33. properties: {
  34. long_name: {
  35. $id:
  36. "#/properties/results/items/properties/address_components/items/properties/long_name",
  37. type: "string",
  38. title: "The Long_name Schema",
  39. default: "",
  40. examples: ["13185-472"],
  41. pattern: "^(.*)$"
  42. },
  43. short_name: {
  44. $id:
  45. "#/properties/results/items/properties/address_components/items/properties/short_name",
  46. type: "string",
  47. title: "The Short_name Schema",
  48. default: "",
  49. examples: ["13185-472"],
  50. pattern: "^(.*)$"
  51. },
  52. types: {
  53. $id:
  54. "#/properties/results/items/properties/address_components/items/properties/types",
  55. type: "array",
  56. title: "The Types Schema",
  57. items: {
  58. $id:
  59. "#/properties/results/items/properties/address_components/items/properties/types/items",
  60. type: "string",
  61. title: "The Items Schema",
  62. default: "",
  63. examples: ["postal_code"],
  64. pattern: "^(.*)$"
  65. }
  66. }
  67. }
  68. }
  69. },
  70. formatted_address: {
  71. $id: "#/properties/results/items/properties/formatted_address",
  72. type: "string",
  73. title: "The Formatted_address Schema",
  74. default: "",
  75. examples: [
  76. "Jardim Nossa Sra. de Fatima, Hortolândia - SP, 13185-472, Brazil"
  77. ],
  78. pattern: "^(.*)$"
  79. },
  80. geometry: {
  81. $id: "#/properties/results/items/properties/geometry",
  82. type: "object",
  83. title: "The Geometry Schema",
  84. required: ["bounds", "location", "location_type", "viewport"],
  85. properties: {
  86. bounds: {
  87. $id:
  88. "#/properties/results/items/properties/geometry/properties/bounds",
  89. type: "object",
  90. title: "The Bounds Schema",
  91. required: ["northeast", "southwest"],
  92. properties: {
  93. northeast: {
  94. $id:
  95. "#/properties/results/items/properties/geometry/properties/bounds/properties/northeast",
  96. type: "object",
  97. title: "The Northeast Schema",
  98. required: ["lat", "lng"],
  99. properties: {
  100. lat: {
  101. $id:
  102. "#/properties/results/items/properties/geometry/properties/bounds/properties/northeast/properties/lat",
  103. type: "number",
  104. title: "The Lat Schema",
  105. default: 0.0,
  106. examples: [-22.8944949]
  107. },
  108. lng: {
  109. $id:
  110. "#/properties/results/items/properties/geometry/properties/bounds/properties/northeast/properties/lng",
  111. type: "number",
  112. title: "The Lng Schema",
  113. default: 0.0,
  114. examples: [-47.1671647]
  115. }
  116. }
  117. },
  118. southwest: {
  119. $id:
  120. "#/properties/results/items/properties/geometry/properties/bounds/properties/southwest",
  121. type: "object",
  122. title: "The Southwest Schema",
  123. required: ["lat", "lng"],
  124. properties: {
  125. lat: {
  126. $id:
  127. "#/properties/results/items/properties/geometry/properties/bounds/properties/southwest/properties/lat",
  128. type: "number",
  129. title: "The Lat Schema",
  130. default: 0.0,
  131. examples: [-22.9005]
  132. },
  133. lng: {
  134. $id:
  135. "#/properties/results/items/properties/geometry/properties/bounds/properties/southwest/properties/lng",
  136. type: "number",
  137. title: "The Lng Schema",
  138. default: 0.0,
  139. examples: [-47.1690001]
  140. }
  141. }
  142. }
  143. }
  144. },
  145. location: {
  146. $id:
  147. "#/properties/results/items/properties/geometry/properties/location",
  148. type: "object",
  149. title: "The Location Schema",
  150. required: ["lat", "lng"],
  151. properties: {
  152. lat: {
  153. $id:
  154. "#/properties/results/items/properties/geometry/properties/location/properties/lat",
  155. type: "number",
  156. title: "The Lat Schema",
  157. default: 0.0,
  158. examples: [-22.8967016]
  159. },
  160. lng: {
  161. $id:
  162. "#/properties/results/items/properties/geometry/properties/location/properties/lng",
  163. type: "number",
  164. title: "The Lng Schema",
  165. default: 0.0,
  166. examples: [-47.1686594]
  167. }
  168. }
  169. },
  170. location_type: {
  171. $id:
  172. "#/properties/results/items/properties/geometry/properties/location_type",
  173. type: "string",
  174. title: "The Location_type Schema",
  175. default: "",
  176. examples: ["APPROXIMATE"],
  177. pattern: "^(.*)$"
  178. },
  179. viewport: {
  180. $id:
  181. "#/properties/results/items/properties/geometry/properties/viewport",
  182. type: "object",
  183. title: "The Viewport Schema",
  184. required: ["northeast", "southwest"],
  185. properties: {
  186. northeast: {
  187. $id:
  188. "#/properties/results/items/properties/geometry/properties/viewport/properties/northeast",
  189. type: "object",
  190. title: "The Northeast Schema",
  191. required: ["lat", "lng"],
  192. properties: {
  193. lat: {
  194. $id:
  195. "#/properties/results/items/properties/geometry/properties/viewport/properties/northeast/properties/lat",
  196. type: "number",
  197. title: "The Lat Schema",
  198. default: 0.0,
  199. examples: [-22.8944949]
  200. },
  201. lng: {
  202. $id:
  203. "#/properties/results/items/properties/geometry/properties/viewport/properties/northeast/properties/lng",
  204. type: "number",
  205. title: "The Lng Schema",
  206. default: 0.0,
  207. examples: [-47.1667334197085]
  208. }
  209. }
  210. },
  211. southwest: {
  212. $id:
  213. "#/properties/results/items/properties/geometry/properties/viewport/properties/southwest",
  214. type: "object",
  215. title: "The Southwest Schema",
  216. required: ["lat", "lng"],
  217. properties: {
  218. lat: {
  219. $id:
  220. "#/properties/results/items/properties/geometry/properties/viewport/properties/southwest/properties/lat",
  221. type: "number",
  222. title: "The Lat Schema",
  223. default: 0.0,
  224. examples: [-22.9005]
  225. },
  226. lng: {
  227. $id:
  228. "#/properties/results/items/properties/geometry/properties/viewport/properties/southwest/properties/lng",
  229. type: "number",
  230. title: "The Lng Schema",
  231. default: 0.0,
  232. examples: [-47.1694313802915]
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. },
  240. place_id: {
  241. $id: "#/properties/results/items/properties/place_id",
  242. type: "string",
  243. title: "The Place_id Schema",
  244. default: "",
  245. examples: ["ChIJYxzhq0-4yJQRWtRa9ywEYyk"],
  246. pattern: "^(.*)$"
  247. },
  248. types: {
  249. $id: "#/properties/results/items/properties/types",
  250. type: "array",
  251. title: "The Types Schema",
  252. items: {
  253. $id: "#/properties/results/items/properties/types/items",
  254. type: "string",
  255. title: "The Items Schema",
  256. default: "",
  257. examples: ["postal_code"],
  258. pattern: "^(.*)$"
  259. }
  260. }
  261. }
  262. }
  263. },
  264. status: {
  265. $id: "#/properties/status",
  266. type: "string",
  267. title: "The Status Schema",
  268. default: "",
  269. examples: ["OK"],
  270. pattern: "^(.*)$"
  271. }
  272. }
  273. });
  274.  
  275. module.exports = {
  276. googleMaps: gmapsObject
  277. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement