Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. 'use strict';
  2.  
  3. const OpenApiBackend = require('openapi-backend').default;
  4.  
  5. start();
  6.  
  7. function start() {
  8. const api = new OpenApiBackend({
  9. definition: {
  10. openapi: '3.0.1',
  11. info: {
  12. title: 'test',
  13. version: '1.0.0'
  14. },
  15. paths: {
  16. '/users/{id}': {
  17. parameters: [{
  18. in: 'path',
  19. name: 'id',
  20. schema: {
  21. type: 'integer',
  22. },
  23. required: true,
  24. description: 'The user ID.'
  25. }],
  26. get: {
  27. operationId: 'getUsers',
  28. parameters: [{
  29. in: 'path',
  30. name: 'id',
  31. required: true,
  32. description: 'A comma-separated list of user IDs.',
  33. schema: {
  34. type: 'array',
  35. items: {type: 'integer'},
  36. minItems: 1
  37. },
  38. explode: false,
  39. style: 'simple'
  40. }],
  41. responses: {
  42. '200': {
  43. description: 'OK'
  44. }
  45. }
  46. }
  47. }
  48. }
  49. },
  50. ajvOpts: {
  51. allErrors: true,
  52. }
  53. });
  54.  
  55. api.init();
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement