Guest User

Untitled

a guest
Jan 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { RedocStandalone as JsonSchemaView } from 'redoc';
  3. import './App.css';
  4.  
  5. class App extends Component {
  6. render() {
  7. const jsonNode = {
  8. "description":"This is an example schema for Pet",
  9. "type":"object",
  10. "properties":{
  11. "category":{
  12. "description":"Categories this pet belongs to",
  13. "type":"object",
  14. "properties":{
  15. "name":{
  16. "description":"Category name",
  17. "type":"string",
  18. "minLength":1
  19. },
  20. "sub":{
  21. "description":"Test Sub Category",
  22. "type":"object",
  23. "properties":{
  24. "prop1":{
  25. "type":"string",
  26. "description":"Dumb property"
  27. }
  28. }
  29. }
  30. }
  31. },
  32. "name":{
  33. "type":"string",
  34. "description":"The name given to a pet",
  35. "example":"Guru"
  36. },
  37. "photoUrls":{
  38. "description":"The list of URLs to a cute photos featuring pet",
  39. "type":"array",
  40. "items":{
  41. "type":"string",
  42. "format":"uri"
  43. },
  44. "maxItems":20
  45. },
  46. "tags":{
  47. "description":"Tags attached to the pet.",
  48. "type":"array",
  49. "items":{
  50. "description":"Tag name",
  51. "type":"string",
  52. "minLength":1
  53. },
  54. "minItems":1
  55. },
  56. "status":{
  57. "description":"Pet status in the store",
  58. "type":"string",
  59. "enum":[
  60. "available",
  61. "pending",
  62. "sold"
  63. ]
  64. },
  65. "petType":{
  66. "description":"Type of a pet",
  67. "type":"string",
  68. "enum":[
  69. "cat",
  70. "dog",
  71. "bee"
  72. ]
  73. },
  74. "huntingSkill":{
  75. "description":"The measured skill for hunting.",
  76. "type":"string",
  77. "default":"lazy",
  78. "enum":[
  79. "clueless",
  80. "lazy",
  81. "adventurous",
  82. "aggressive"
  83. ]
  84. }
  85. },
  86. "required":[
  87. "name",
  88. "photoUrls",
  89. "huntingSkill"
  90. ]
  91. };
  92.  
  93. return (
  94. <div className="App">
  95. <JsonSchemaView specNode={jsonNode} />
  96. </div>
  97. );
  98. }
  99. }
  100.  
  101. export default App;
Add Comment
Please, Sign In to add comment