diff --git a/src/Lib/Annotation/SwagForm.php b/src/Lib/Annotation/SwagForm.php index 313e54e1..33f146de 100644 --- a/src/Lib/Annotation/SwagForm.php +++ b/src/Lib/Annotation/SwagForm.php @@ -27,11 +27,13 @@ public function __construct(array $values) throw new InvalidArgumentException('Name parameter is required'); } - $type = strtolower($values['type']); + $values = array_merge(['type' => 'string', 'required' => false], $values); - if (!in_array($type, OpenApiDataType::TYPES)) { + if (!in_array($values['type'], OpenApiDataType::TYPES)) { + $type = $values['type']; + $name = $values['name']; throw new SwaggerBakeRunTimeException( - "Invalid Data Type, given `$type` but must be one of: " . + "Invalid Data Type, given [$type] for [$name] but must be one of: " . implode(',', OpenApiDataType::TYPES) ); } @@ -39,7 +41,7 @@ public function __construct(array $values) $values = array_merge(['type' => 'string', 'required' => false], $values); $this->name = $values['name']; - $this->type = $type; + $this->type = $values['type']; $this->required = $values['required']; } } \ No newline at end of file diff --git a/src/Lib/Annotation/SwagQuery.php b/src/Lib/Annotation/SwagQuery.php index f1e476cc..c9f9cc5e 100644 --- a/src/Lib/Annotation/SwagQuery.php +++ b/src/Lib/Annotation/SwagQuery.php @@ -27,19 +27,19 @@ public function __construct(array $values) throw new InvalidArgumentException('Name parameter is required'); } - $type = strtolower($values['type']); + $values = array_merge(['type' => 'string', 'required' => false], $values); - if (!in_array($type, OpenApiDataType::TYPES)) { + if (!in_array($values['type'], OpenApiDataType::TYPES)) { + $type = $values['type']; + $name = $values['name']; throw new SwaggerBakeRunTimeException( - "Invalid Data Type, given `$type` but must be one of: " . + "Invalid Data Type, given [$type] for [$name] but must be one of: " . implode(',', OpenApiDataType::TYPES) ); } - $values = array_merge(['type' => $type, 'required' => false], $values); - $this->name = $values['name']; - $this->type = $type; + $this->type = $values['type']; $this->required = $values['required']; } } \ No newline at end of file