shalvah 3 年之前
父节点
当前提交
d0a69809f2
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. 2 0
      CHANGELOG.md
  2. 2 0
      src/Extracting/Strategies/UrlParameters/GetFromLaravelAPI.php

+ 2 - 0
CHANGELOG.md

@@ -13,6 +13,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 ### Removals
 
 ## 3.4.2 (Monday, 5 July 2021)
+### Modified
+- Only use model key type for URL param type if it's the same as the route key name (https://github.com/knuckleswtf/scribe/pull/265)
 ### Fixed
 - Merge user-defined endpoints correctly. (https://github.com/knuckleswtf/scribe/commit/b7f8539b1bd5cd4d97496fa93803a3d7894889f6)
 

+ 2 - 0
src/Extracting/Strategies/UrlParameters/GetFromLaravelAPI.php

@@ -66,6 +66,8 @@ class GetFromLaravelAPI extends Strategy
                         continue;
                     }
 
+                    // If a user customized their routeKeyName,
+                    // we can't guarantee that it's the same type as the PK
                     $typeName = $argumentInstance->getKeyName() === $argumentInstance->getRouteKeyName()
                         ? $argumentInstance->getKeyType() : 'string';
                     $type = $this->normalizeTypeName($typeName);