diff --git a/src/OpenApiType.php b/src/OpenApiType.php index e0f3217..5d6d6c7 100644 --- a/src/OpenApiType.php +++ b/src/OpenApiType.php @@ -308,6 +308,7 @@ private static function resolveIdentifier(string $context, array $definitions, s "negative-int" => new OpenApiType(type: "integer", format: "int64", maximum: -1), "non-positive-int" => new OpenApiType(type: "integer", format: "int64", maximum: 0), "bool", "boolean", "true", "false" => new OpenApiType(type: "boolean"), + "numeric" => new OpenApiType(type: "number"), "double" => new OpenApiType(type: "number", format: "double"), "float" => new OpenApiType(type: "number", format: "float"), "mixed", "empty", "array" => new OpenApiType(type: "object"), diff --git a/tests/appinfo/routes.php b/tests/appinfo/routes.php index 66638f0..e558074 100644 --- a/tests/appinfo/routes.php +++ b/tests/appinfo/routes.php @@ -46,5 +46,6 @@ ['name' => 'Settings#booleanParameterRequired', 'url' => '/api/{apiVersion}/boolean', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], ['name' => 'Settings#booleanParameterDefaultFalse', 'url' => '/api/{apiVersion}/boolean-false', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], ['name' => 'Settings#booleanParameterDefaultTrue', 'url' => '/api/{apiVersion}/boolean-true', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#numericParameter', 'url' => '/api/{apiVersion}/numeric', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], ], ]; diff --git a/tests/lib/Controller/SettingsController.php b/tests/lib/Controller/SettingsController.php index acd82aa..2fb2c8e 100644 --- a/tests/lib/Controller/SettingsController.php +++ b/tests/lib/Controller/SettingsController.php @@ -257,4 +257,16 @@ public function booleanParameterDefaultFalse(bool $yesOrNo = false): DataRespons public function booleanParameterDefaultTrue(bool $yesOrNo = true): DataResponse { return new DataResponse(); } + + /** + * A route with numeric + * + * @param numeric $value Some numeric value + * @return DataResponse, array{}> + * + * 200: Admin settings updated + */ + public function numericParameter(mixed $value): DataResponse { + return new DataResponse(); + } } diff --git a/tests/openapi.json b/tests/openapi.json index f0acb00..f571deb 100644 --- a/tests/openapi.json +++ b/tests/openapi.json @@ -1626,6 +1626,87 @@ } } } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/numeric": { + "post": { + "operationId": "settings-numeric-parameter", + "summary": "A route with numeric", + "description": "This endpoint requires admin access", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "value", + "in": "query", + "description": "Some numeric value", + "required": true, + "schema": { + "type": "number" + } + }, + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Admin settings updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } } }, "tags": []