diff --git a/src/OpenApiType.php b/src/OpenApiType.php index 398c55b..4362673 100644 --- a/src/OpenApiType.php +++ b/src/OpenApiType.php @@ -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!'); diff --git a/tests/openapi-administration.json b/tests/openapi-administration.json index 98e48c6..ca4f4d3 100644 --- a/tests/openapi-administration.json +++ b/tests/openapi-administration.json @@ -7656,11 +7656,7 @@ "description": "Not deprecated", "required": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean" } }, { @@ -7950,11 +7946,7 @@ "description": "Not deprecated", "required": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean" } }, { @@ -7964,11 +7956,8 @@ "required": true, "deprecated": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean", + "deprecated": true } }, { @@ -8260,11 +8249,7 @@ "description": "Not deprecated", "required": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean" } }, { @@ -8274,11 +8259,8 @@ "required": true, "deprecated": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean", + "deprecated": true } }, { diff --git a/tests/openapi-full.json b/tests/openapi-full.json index e138a8a..ff0935d 100644 --- a/tests/openapi-full.json +++ b/tests/openapi-full.json @@ -7843,11 +7843,7 @@ "description": "Not deprecated", "required": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean" } }, { @@ -8137,11 +8133,7 @@ "description": "Not deprecated", "required": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean" } }, { @@ -8151,11 +8143,8 @@ "required": true, "deprecated": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean", + "deprecated": true } }, { @@ -8447,11 +8436,7 @@ "description": "Not deprecated", "required": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean" } }, { @@ -8461,11 +8446,8 @@ "required": true, "deprecated": true, "schema": { - "type": "integer", - "enum": [ - 0, - 1 - ] + "type": "boolean", + "deprecated": true } }, {