[PHP-Symfony] Encurage Symfony 5 bundle directory structure best practices (#13014)

* use .yaml instead of .yml

This is recommended by Symfony standards

* save Bundle files also to src path

* add test for generate ping

* add package imports

* fix expected file names

* why is Api/ApiServer.php missing

* output filenames

* use getAbsolutePath for debug purpose

* do not use punctuation as current directory

* refactor: remove todos

* use also .yaml in test to fix it

* add test for setting a different source directory

* use correct const for setting source dir property in tests

* import the AbstractPhpCodegen in test class

* put also Resources to source path

* save docs not to Resources

* update samples and improve src path in autoload.php and composer.json

* update moved samples
This commit is contained in:
Luka Dschaak
2022-09-18 09:16:27 +02:00
committed by GitHub
parent 43375b9392
commit c4a3866e75
31 changed files with 204 additions and 79 deletions

View File

@@ -60,7 +60,7 @@ Step 3: Register the routes:
```yaml
# app/config/routes.yaml
open_api_server:
resource: "@OpenAPIServerBundle/Resources/config/routing.yml"
resource: "@OpenAPIServerBundle/Resources/config/routing.yaml"
```
Step 4: Implement the API calls:
@@ -99,7 +99,7 @@ class PetApi implements PetApiInterface // An interface is autogenerated
Step 5: Tag your API implementation:
```yaml
# config/services.yml
# config/services.yaml
services:
# ...
Acme\MyBundle\Api\PetApi:
@@ -117,36 +117,36 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApiInterface* | [**addPet**](Resources/docs/Api/PetApiInterface.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApiInterface* | [**deletePet**](Resources/docs/Api/PetApiInterface.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApiInterface* | [**findPetsByStatus**](Resources/docs/Api/PetApiInterface.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApiInterface* | [**findPetsByTags**](Resources/docs/Api/PetApiInterface.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApiInterface* | [**getPetById**](Resources/docs/Api/PetApiInterface.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApiInterface* | [**updatePet**](Resources/docs/Api/PetApiInterface.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApiInterface* | [**updatePetWithForm**](Resources/docs/Api/PetApiInterface.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApiInterface* | [**uploadFile**](Resources/docs/Api/PetApiInterface.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApiInterface* | [**deleteOrder**](Resources/docs/Api/StoreApiInterface.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApiInterface* | [**getInventory**](Resources/docs/Api/StoreApiInterface.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApiInterface* | [**getOrderById**](Resources/docs/Api/StoreApiInterface.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApiInterface* | [**placeOrder**](Resources/docs/Api/StoreApiInterface.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApiInterface* | [**createUser**](Resources/docs/Api/UserApiInterface.md#createuser) | **POST** /user | Create user
*UserApiInterface* | [**createUsersWithArrayInput**](Resources/docs/Api/UserApiInterface.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApiInterface* | [**createUsersWithListInput**](Resources/docs/Api/UserApiInterface.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApiInterface* | [**deleteUser**](Resources/docs/Api/UserApiInterface.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApiInterface* | [**getUserByName**](Resources/docs/Api/UserApiInterface.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApiInterface* | [**loginUser**](Resources/docs/Api/UserApiInterface.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApiInterface* | [**logoutUser**](Resources/docs/Api/UserApiInterface.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApiInterface* | [**updateUser**](Resources/docs/Api/UserApiInterface.md#updateuser) | **PUT** /user/{username} | Updated user
*PetApiInterface* | [**addPet**](docs/Api/PetApiInterface.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApiInterface* | [**deletePet**](docs/Api/PetApiInterface.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApiInterface* | [**findPetsByStatus**](docs/Api/PetApiInterface.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApiInterface* | [**findPetsByTags**](docs/Api/PetApiInterface.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApiInterface* | [**getPetById**](docs/Api/PetApiInterface.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApiInterface* | [**updatePet**](docs/Api/PetApiInterface.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApiInterface* | [**updatePetWithForm**](docs/Api/PetApiInterface.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApiInterface* | [**uploadFile**](docs/Api/PetApiInterface.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApiInterface* | [**deleteOrder**](docs/Api/StoreApiInterface.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApiInterface* | [**getInventory**](docs/Api/StoreApiInterface.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApiInterface* | [**getOrderById**](docs/Api/StoreApiInterface.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApiInterface* | [**placeOrder**](docs/Api/StoreApiInterface.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApiInterface* | [**createUser**](docs/Api/UserApiInterface.md#createuser) | **POST** /user | Create user
*UserApiInterface* | [**createUsersWithArrayInput**](docs/Api/UserApiInterface.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApiInterface* | [**createUsersWithListInput**](docs/Api/UserApiInterface.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApiInterface* | [**deleteUser**](docs/Api/UserApiInterface.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApiInterface* | [**getUserByName**](docs/Api/UserApiInterface.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApiInterface* | [**loginUser**](docs/Api/UserApiInterface.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApiInterface* | [**logoutUser**](docs/Api/UserApiInterface.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApiInterface* | [**updateUser**](docs/Api/UserApiInterface.md#updateuser) | **PUT** /user/{username} | Updated user
## Documentation For Models
- [ApiResponse](Resources/docs/Model/ApiResponse.md)
- [Category](Resources/docs/Model/Category.md)
- [Order](Resources/docs/Model/Order.md)
- [Pet](Resources/docs/Model/Pet.md)
- [Tag](Resources/docs/Model/Tag.md)
- [User](Resources/docs/Model/User.md)
- [ApiResponse](docs/Model/ApiResponse.md)
- [Category](docs/Model/Category.md)
- [Order](docs/Model/Order.md)
- [Pet](docs/Model/Pet.md)
- [Tag](docs/Model/Tag.md)
- [User](docs/Model/User.md)
## Documentation For Authorization