mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 23:17:06 +00:00
[php-symfony] Symfony6 support (#11810)
* support symfony6
* fix issues with StrictJsonDeserialization
* regenerate samples
* add suggestions
* update samples
* support php 7.4 and symfony 5
* allow versions based on semantic versioning
* regenerate sample
* change method of determining result types
* update samples
* describe usage of bundle in symfony app
* better documentation
* fix duplicate auth methods
* do not set namespace for default types
* fix UploadedFile type
* next try fixing auth
* regenerate samples
* fix: auth method shall not be duplicated
* Revert "fix duplicate auth methods"
This reverts commit 0dc418737b.
* chore: regenerate samples
* fix tests
* regenerate sample
* more fixes for tests
* update tests
* add kernel shutdown
Co-authored-by: Benjamin Haeublein <benjaminh@testing-vm.lan.benjaminh.de>
Co-authored-by: Renaud de Chivré <renaud@tahitiwebdesign.com>
This commit is contained in:
committed by
GitHub
parent
96dd6c5806
commit
77fa028bb3
@@ -8,7 +8,7 @@ This [Symfony](https://symfony.com/) bundle is automatically generated by the [O
|
||||
|
||||
## Requirements
|
||||
|
||||
PHP 7.1.3 and later
|
||||
PHP 8.0 and later
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
@@ -45,26 +45,20 @@ composer install
|
||||
|
||||
Step 1: Please follow the [installation procedure](#installation--usage) first.
|
||||
|
||||
Step 2: Enable the bundle in the kernel:
|
||||
Step 2: Enable the bundle in the bundle configuration:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// app/AppKernel.php
|
||||
|
||||
public function registerBundles()
|
||||
{
|
||||
$bundles = array(
|
||||
// ...
|
||||
new OpenAPI\Server\OpenAPIServerBundle(),
|
||||
// ...
|
||||
);
|
||||
}
|
||||
// app/config/bundles.php
|
||||
return [
|
||||
// ...
|
||||
OpenAPI\Server\OpenAPIServerBundle::class => ['all' => true],
|
||||
];
|
||||
```
|
||||
|
||||
Step 3: Register the routes:
|
||||
|
||||
```yaml
|
||||
# app/config/routing.yml
|
||||
# app/config/routes.yaml
|
||||
open_api_server:
|
||||
resource: "@OpenAPIServerBundle/Resources/config/routing.yml"
|
||||
```
|
||||
@@ -93,7 +87,7 @@ class PetApi implements PetApiInterface // An interface is autogenerated
|
||||
/**
|
||||
* Implementation of PetApiInterface#addPet
|
||||
*/
|
||||
public function addPet(Pet $pet)
|
||||
public function addPet(Pet $pet, &$responseCode, array &$responseHeaders): array|\OpenAPI\Server\Model\Pet
|
||||
{
|
||||
// Implement the operation ...
|
||||
}
|
||||
@@ -105,11 +99,10 @@ class PetApi implements PetApiInterface // An interface is autogenerated
|
||||
Step 5: Tag your API implementation:
|
||||
|
||||
```yaml
|
||||
# src/Acme/MyBundle/Resources/services.yml
|
||||
# config/services.yml
|
||||
services:
|
||||
# ...
|
||||
acme.my_bundle.api.pet:
|
||||
class: Acme\MyBundle\Api\PetApi
|
||||
Acme\MyBundle\Api\PetApi:
|
||||
tags:
|
||||
- { name: "open_api_server.api", api: "pet" }
|
||||
# ...
|
||||
|
||||
Reference in New Issue
Block a user