Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/OpenApiType.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,6 @@ public function __construct(

public function toArray(bool $isParameter = false): array|stdClass {
if ($isParameter) {
if ($this->type === 'boolean') {
return (new OpenApiType(
context: $this->context,
type: 'integer',
nullable: $this->nullable,
hasDefaultValue: $this->hasDefaultValue,
defaultValue: $this->hasDefaultValue ? ($this->defaultValue === true ? 1 : 0) : (null),
description: $this->description,
enum: [0, 1],
))->toArray($isParameter);
}

if ($this->type === 'object' || $this->ref !== null || $this->anyOf !== null || $this->allOf !== null) {
Logger::warning($this->context, 'Complex types can not be part of query or URL parameters. Falling back to string due to undefined serialization!');

Expand Down
32 changes: 7 additions & 25 deletions tests/openapi-administration.json
Original file line number Diff line number Diff line change
Expand Up @@ -7656,11 +7656,7 @@
"description": "Not deprecated",
"required": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean"
}
},
{
Expand Down Expand Up @@ -7950,11 +7946,7 @@
"description": "Not deprecated",
"required": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean"
}
},
{
Expand All @@ -7964,11 +7956,8 @@
"required": true,
"deprecated": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean",
"deprecated": true
}
},
{
Expand Down Expand Up @@ -8260,11 +8249,7 @@
"description": "Not deprecated",
"required": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean"
}
},
{
Expand All @@ -8274,11 +8259,8 @@
"required": true,
"deprecated": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean",
"deprecated": true
}
},
{
Expand Down
32 changes: 7 additions & 25 deletions tests/openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -7843,11 +7843,7 @@
"description": "Not deprecated",
"required": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean"
}
},
{
Expand Down Expand Up @@ -8137,11 +8133,7 @@
"description": "Not deprecated",
"required": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean"
}
},
{
Expand All @@ -8151,11 +8143,8 @@
"required": true,
"deprecated": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean",
"deprecated": true
}
},
{
Expand Down Expand Up @@ -8447,11 +8436,7 @@
"description": "Not deprecated",
"required": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean"
}
},
{
Expand All @@ -8461,11 +8446,8 @@
"required": true,
"deprecated": true,
"schema": {
"type": "integer",
"enum": [
0,
1
]
"type": "boolean",
"deprecated": true
}
},
{
Expand Down