scribe_new.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. use Knuckles\Scribe\Extracting\Strategies;
  3. use Knuckles\Scribe;
  4. /**
  5. * For documentation, use your IDE's features, or see https://scribe.knuckles.wtf/laravel/reference/config
  6. */
  7. return Scribe\Config\Factory::make(
  8. extracting: Scribe\Config\Extracting::with(
  9. routes: Scribe\Config\Routes::match(
  10. prefixes: ['api/*'],
  11. domains: ['*'],
  12. alwaysInclude: [],
  13. alwaysExclude: [],
  14. ),
  15. defaultGroup: 'Endpoints',
  16. databaseConnectionsToTransact: [config('database.default')],
  17. fakerSeedForExamples: null,
  18. dataSourcesForExampleModels: ['factoryCreate', 'factoryMake', 'databaseFirst'],
  19. auth: Scribe\Config\Extracting::auth(
  20. enabled: false,
  21. default: false,
  22. in: 'bearer',
  23. useValue: env('SCRIBE_AUTH_KEY'),
  24. placeholder: '{YOUR_AUTH_KEY}',
  25. extraInfo: <<<AUTH
  26. You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.
  27. AUTH
  28. ),
  29. strategies: Scribe\Config\Extracting::strategies(
  30. metadata: Scribe\Config\Defaults::metadataStrategies(),
  31. urlParameters: Scribe\Config\Defaults::urlParametersStrategies(),
  32. queryParameters: Scribe\Config\Defaults::queryParametersStrategies(),
  33. headers: Scribe\Config\Defaults::headersStrategies()
  34. ->override([
  35. 'Content-Type' => 'application/json',
  36. 'Accept' => 'application/json',
  37. ]),
  38. bodyParameters: Scribe\Config\Defaults::bodyParametersStrategies(),
  39. responses: Scribe\Config\Defaults::responsesStrategies()
  40. ->configure(Strategies\Responses\ResponseCalls::withSettings(
  41. only: ['GET *'],
  42. config: [
  43. 'app.env' => 'documentation',
  44. // 'app.debug' => false,
  45. ],
  46. queryParams: [],
  47. bodyParams: [],
  48. fileParams: [],
  49. cookies: [],
  50. )),
  51. responseFields: Scribe\Config\Defaults::responseFieldsStrategies(),
  52. )
  53. ),
  54. output: Scribe\Config\Output::with(
  55. theme: 'default',
  56. title: null,
  57. description: '',
  58. baseUrls: [
  59. "production" => config("app.base_url"),
  60. ],
  61. exampleLanguages: ['bash', 'javascript'],
  62. logo: false,
  63. lastUpdated: 'Last updated: {date:F j, Y}',
  64. introText: <<<INTRO
  65. This documentation aims to provide all the information you need to work with our API.
  66. <aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
  67. You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
  68. INTRO,
  69. groupsOrder: [
  70. // 'This group will come first',
  71. // 'This group will come next' => [
  72. // 'POST /this-endpoint-will-come-first',
  73. // 'GET /this-endpoint-will-come-next',
  74. // ],
  75. // 'This group will come third' => [
  76. // 'This subgroup will come first' => [
  77. // 'GET /this-other-endpoint-will-come-first',
  78. // ]
  79. // ]
  80. ],
  81. type: Scribe\Config\Output::staticType(
  82. outputPath: 'public/docs'
  83. ),
  84. postman: Scribe\Config\Output::postman(
  85. enabled: true,
  86. overrides: [
  87. // 'info.version' => '2.0.0',
  88. ]
  89. ),
  90. openApi: Scribe\Config\Output::openApi(
  91. enabled: true,
  92. overrides: [
  93. // 'info.version' => '2.0.0',
  94. ]
  95. ),
  96. tryItOut: Scribe\Config\Output::tryItOut(
  97. enabled: true,
  98. )
  99. )
  100. );