Jelajahi Sumber

Merge branch 'master' into v4

# Conflicts:
#	CHANGELOG.md
#	src/Tools/Globals.php
shalvah 2 tahun lalu
induk
melakukan
78bcbe78e7
3 mengubah file dengan 11 tambahan dan 7 penghapusan
  1. 4 0
      CHANGELOG.md
  2. 5 5
      camel/Output/OutputEndpointData.php
  3. 2 2
      src/Writing/Writer.php

+ 4 - 0
CHANGELOG.md

@@ -24,6 +24,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 - Basic support for overriding docs for inherited methods ([9735fdf](9735fdf150469f186bab395fcfabd042f570c50c))
 - note views may have changed
 
+## 3.37.2 (8 September 2022)
+### Fixed
+- Multi-docs: Use correct routes in Laravel view ([a41e717](https://github.com/knuckleswtf/scribe/commit/a41e71707b3a33e4c80614c678c389c9fd5196de))
+
 ## 3.37.1 (5 September 2022)
 ### Fixed
 - Fix regression in parsing API resource tags that have a status code when generating response fields ([#516](https://github.com/knuckleswtf/scribe/pull/516))

+ 5 - 5
camel/Output/OutputEndpointData.php

@@ -89,19 +89,19 @@ class OutputEndpointData extends BaseDTO
     public function __construct(array $parameters = [])
     {
         // spatie/dto currently doesn't auto-cast nested DTOs like that
-        $parameters['responses'] = new ResponseCollection($parameters['responses']);
+        $parameters['responses'] = new ResponseCollection($parameters['responses'] ?? []);
         $parameters['bodyParameters'] = array_map(function ($param) {
             return new Parameter($param);
-        }, $parameters['bodyParameters']);
+        }, $parameters['bodyParameters'] ?? []);
         $parameters['queryParameters'] = array_map(function ($param) {
             return new Parameter($param);
-        }, $parameters['queryParameters']);
+        }, $parameters['queryParameters'] ?? []);
         $parameters['urlParameters'] = array_map(function ($param) {
             return new Parameter($param);
-        }, $parameters['urlParameters']);
+        }, $parameters['urlParameters'] ?? []);
         $parameters['responseFields'] = array_map(function ($param) {
             return new ResponseField($param);
-        }, $parameters['responseFields']);
+        }, $parameters['responseFields'] ?? []);
 
         parent::__construct($parameters);
 

+ 2 - 2
src/Writing/Writer.php

@@ -180,8 +180,8 @@ class Writer
         // Rewrite asset links to go through Laravel
         $contents = preg_replace('#href="\.\./docs/css/(.+?)"#', 'href="{{ asset("' . $this->laravelAssetsPath . '/css/$1") }}"', $contents);
         $contents = preg_replace('#src="\.\./docs/(js|images)/(.+?)"#', 'src="{{ asset("' . $this->laravelAssetsPath . '/$1/$2") }}"', $contents);
-        $contents = str_replace('href="../docs/collection.json"', 'href="{{ route("scribe.postman") }}"', $contents);
-        $contents = str_replace('href="../docs/openapi.yaml"', 'href="{{ route("scribe.openapi") }}"', $contents);
+        $contents = str_replace('href="../docs/collection.json"', 'href="{{ route("'.$this->docsName.'.postman") }}"', $contents);
+        $contents = str_replace('href="../docs/openapi.yaml"', 'href="{{ route("'.$this->docsName.'.openapi") }}"', $contents);
 
         file_put_contents("$this->laravelTypeOutputPath/index.blade.php", $contents);
     }