forked from loafle/openapi-generator-original
[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:
parent
43375b9392
commit
c4a3866e75
@ -245,21 +245,22 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public String toSrcPath(String packageName, String basePath) {
|
||||
packageName = packageName.replace(invokerPackage, ""); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
if (basePath != null && basePath.length() > 0) {
|
||||
basePath = basePath.replaceAll("[\\\\/]?$", "") + File.separator; // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
public String toSrcPath(final String packageName, final String basePath) {
|
||||
String modifiedPackageName = packageName.replace(invokerPackage, "");
|
||||
String modifiedBasePath = basePath;
|
||||
if (basePath != null && !basePath.isEmpty()) {
|
||||
modifiedBasePath = basePath.replaceAll("[\\\\/]?$", "") + File.separator;
|
||||
}
|
||||
|
||||
// Trim prefix file separators from package path
|
||||
String packagePath = StringUtils.removeStart(
|
||||
// Replace period, backslash, forward slash with file separator in package name
|
||||
packageName.replaceAll("[\\.\\\\/]", Matcher.quoteReplacement("/")),
|
||||
modifiedPackageName.replaceAll("[\\.\\\\/]", Matcher.quoteReplacement("/")),
|
||||
File.separator
|
||||
);
|
||||
|
||||
// Trim trailing file separators from the overall path
|
||||
return StringUtils.removeEnd(basePath + packagePath, File.separator);
|
||||
return StringUtils.removeEnd(modifiedBasePath + packagePath, File.separator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,12 +106,12 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
||||
importMapping.clear();
|
||||
|
||||
supportsInheritance = true;
|
||||
srcBasePath = ".";
|
||||
srcBasePath = "";
|
||||
setInvokerPackage("OpenAPI\\Server");
|
||||
setBundleName("OpenAPIServer");
|
||||
setBundleAlias("open_api_server");
|
||||
modelDirName = "Model";
|
||||
docsBasePath = "Resources" + "/" + "docs";
|
||||
docsBasePath = "docs";
|
||||
apiDocPath = docsBasePath + "/" + apiDirName;
|
||||
modelDocPath = docsBasePath + "/" + modelDirName;
|
||||
outputFolder = "generated-code" + File.separator + "php";
|
||||
@ -316,6 +316,9 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
||||
additionalProperties.put("bundleExtensionName", bundleExtensionName);
|
||||
additionalProperties.put("bundleAlias", bundleAlias);
|
||||
|
||||
// add trailing slash for mustache templates
|
||||
additionalProperties.put("relativeSrcBasePath", srcBasePath.isEmpty() ? "" : srcBasePath + "/");
|
||||
|
||||
// make api and model src path available in mustache template
|
||||
additionalProperties.put("apiSrcPath", "." + "/" + toSrcPath(apiPackage, srcBasePath));
|
||||
additionalProperties.put("modelSrcPath", "." + "/" + toSrcPath(modelPackage, srcBasePath));
|
||||
@ -336,11 +339,12 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
||||
|
||||
final String configDir = "Resources" + File.separator + "config";
|
||||
final String dependencyInjectionDir = "DependencyInjection";
|
||||
final String compilerDir = dependencyInjectionDir + File.separator + "Compiler";
|
||||
|
||||
supportingFiles.add(new SupportingFile("Controller.mustache", toSrcPath(controllerPackage, srcBasePath), "Controller.php"));
|
||||
supportingFiles.add(new SupportingFile("Bundle.mustache", "", bundleClassName + ".php"));
|
||||
supportingFiles.add(new SupportingFile("Extension.mustache", dependencyInjectionDir, bundleExtensionName + ".php"));
|
||||
supportingFiles.add(new SupportingFile("ApiPass.mustache", dependencyInjectionDir + File.separator + "Compiler", bundleName + "ApiPass.php"));
|
||||
supportingFiles.add(new SupportingFile("Bundle.mustache", toSrcPath("", srcBasePath), bundleClassName + ".php"));
|
||||
supportingFiles.add(new SupportingFile("Extension.mustache", toSrcPath(dependencyInjectionDir, srcBasePath), bundleExtensionName + ".php"));
|
||||
supportingFiles.add(new SupportingFile("ApiPass.mustache", toSrcPath(compilerDir, srcBasePath), bundleName + "ApiPass.php"));
|
||||
supportingFiles.add(new SupportingFile("ApiServer.mustache", toSrcPath(apiPackage, srcBasePath), "ApiServer.php"));
|
||||
|
||||
// Serialization components
|
||||
@ -357,10 +361,10 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
||||
supportingFiles.add(new SupportingFile("testing/phpunit.xml.mustache", "", "phpunit.xml.dist"));
|
||||
supportingFiles.add(new SupportingFile("testing/AppKernel.mustache", toSrcPath(testsPackage, srcBasePath), "AppKernel.php"));
|
||||
supportingFiles.add(new SupportingFile("testing/ControllerTest.mustache", toSrcPath(controllerTestsPackage, srcBasePath), "ControllerTest.php"));
|
||||
supportingFiles.add(new SupportingFile("testing/test_config.yml", toSrcPath(testsPackage, srcBasePath), "test_config.yml"));
|
||||
supportingFiles.add(new SupportingFile("testing/test_config.yml", toSrcPath(testsPackage, srcBasePath), "test_config.yaml"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("routing.mustache", configDir, "routing.yml"));
|
||||
supportingFiles.add(new SupportingFile("services.mustache", configDir, "services.yml"));
|
||||
supportingFiles.add(new SupportingFile("routing.mustache", toSrcPath(configDir, srcBasePath), "routing.yaml"));
|
||||
supportingFiles.add(new SupportingFile("services.mustache", toSrcPath(configDir, srcBasePath), "services.yaml"));
|
||||
supportingFiles.add(new SupportingFile("composer.mustache", "", "composer.json"));
|
||||
supportingFiles.add(new SupportingFile("autoload.mustache", "", "autoload.php"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
|
@ -37,7 +37,7 @@ class {{bundleExtensionName}} extends Extension
|
||||
public function load(array $configs, ContainerBuilder $container): void
|
||||
{
|
||||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
$loader->load('services.yaml');
|
||||
}
|
||||
|
||||
public function getAlias(): string
|
||||
|
@ -71,7 +71,7 @@ Step 3: Register the routes:
|
||||
```yaml
|
||||
# app/config/routes.yaml
|
||||
{{bundleAlias}}:
|
||||
resource: "@{{bundleName}}Bundle/Resources/config/routing.yml"
|
||||
resource: "@{{bundleName}}Bundle/Resources/config/routing.yaml"
|
||||
```
|
||||
|
||||
Step 4: Implement the API calls:
|
||||
@ -119,7 +119,7 @@ class {{baseName}}Api implements {{classname}} // An interface is autogenerated
|
||||
Step 5: Tag your API implementation:
|
||||
|
||||
```yaml
|
||||
# config/services.yml
|
||||
# config/services.yaml
|
||||
services:
|
||||
# ...
|
||||
Acme\MyBundle\Api\{{baseName}}Api:
|
||||
|
@ -11,7 +11,7 @@ Method | HTTP request | Description
|
||||
{{#operations}}
|
||||
## Service Declaration
|
||||
```yaml
|
||||
# config/services.yml
|
||||
# config/services.yaml
|
||||
services:
|
||||
# ...
|
||||
Acme\MyBundle\Api\{{baseName}}Api:
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* After registering this autoload function with SPL, the following line
|
||||
* would cause the function to attempt to load the \{{invokerPackage}}\Baz\Qux class
|
||||
* from /path/to/project/{{srcBasePath}}/Baz/Qux.php:
|
||||
* from /path/to/project/{{relativeSrcBasePath}}Baz/Qux.php:
|
||||
*
|
||||
* new \{{invokerPackage}}\Baz\Qux;
|
||||
*
|
||||
@ -20,7 +20,7 @@ spl_autoload_register(function ($class) {
|
||||
$prefix = '{{escapedInvokerPackage}}\\';
|
||||
|
||||
// base directory for the namespace prefix
|
||||
$base_dir = __DIR__ . '/{{srcBasePath}}/';
|
||||
$base_dir = __DIR__ . '/{{relativeSrcBasePath}}';
|
||||
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
|
@ -36,7 +36,7 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/"
|
||||
"{{escapedInvokerPackage}}\\" : "{{relativeSrcBasePath}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
!var/sessions/.gitkeep
|
||||
|
||||
# Parameters
|
||||
/app/config/parameters.yml
|
||||
/app/config/parameters.yaml
|
||||
/app/config/parameters.ini
|
||||
|
||||
# Managed by Composer
|
||||
|
@ -24,6 +24,6 @@ class AppKernel extends Kernel
|
||||
*/
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
$loader->load(__DIR__.'/test_config.yml');
|
||||
$loader->load(__DIR__.'/test_config.yaml');
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
imports:
|
||||
- { resource: "../Resources/config/services.yml" }
|
||||
- { resource: "../Resources/config/services.yaml" }
|
||||
|
||||
framework:
|
||||
secret: "testsecret"
|
||||
test: ~
|
||||
router:
|
||||
resource: "%kernel.project_dir%/Resources/config/routing.yml"
|
||||
resource: "%kernel.project_dir%/Resources/config/routing.yaml"
|
||||
|
@ -17,11 +17,23 @@
|
||||
|
||||
package org.openapitools.codegen.php;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.openapitools.codegen.ClientOptInput;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.DefaultGenerator;
|
||||
import org.openapitools.codegen.TestUtils;
|
||||
import org.openapitools.codegen.config.CodegenConfigurator;
|
||||
import org.openapitools.codegen.languages.AbstractPhpCodegen;
|
||||
import org.openapitools.codegen.languages.PhpSymfonyServerCodegen;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
public class PhpSymfonyServerCodegenTest {
|
||||
|
||||
@Test
|
||||
@ -53,4 +65,112 @@ public class PhpSymfonyServerCodegenTest {
|
||||
Assert.assertEquals(codegen.isHideGenerationTimestamp(), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGeneratePing() throws Exception {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("php-symfony")
|
||||
.setAdditionalProperties(properties)
|
||||
.setInputSpec("src/test/resources/3_0/ping.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
final ClientOptInput clientOptInput = configurator.toClientOptInput();
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(clientOptInput).generate();
|
||||
|
||||
Assert.assertEquals(files.size(), 33);
|
||||
TestUtils.ensureContainsFile(files, output, ".coveralls.yml");
|
||||
TestUtils.ensureContainsFile(files, output, ".gitignore");
|
||||
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
|
||||
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
|
||||
TestUtils.ensureContainsFile(files, output, ".openapi-generator/VERSION");
|
||||
TestUtils.ensureContainsFile(files, output, ".php_cs.dist");
|
||||
TestUtils.ensureContainsFile(files, output, ".travis.yml");
|
||||
TestUtils.ensureContainsFile(files, output, "autoload.php");
|
||||
TestUtils.ensureContainsFile(files, output, "composer.json");
|
||||
TestUtils.ensureContainsFile(files, output, "git_push.sh");
|
||||
TestUtils.ensureContainsFile(files, output, "phpunit.xml.dist");
|
||||
TestUtils.ensureContainsFile(files, output, "README.md");
|
||||
TestUtils.ensureContainsFile(files, output, "Api/ApiServer.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Api/DefaultApiInterface.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Controller/Controller.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Controller/DefaultController.php");
|
||||
TestUtils.ensureContainsFile(files, output, "DependencyInjection/Compiler/OpenAPIServerApiPass.php");
|
||||
TestUtils.ensureContainsFile(files, output, "DependencyInjection/OpenAPIServerExtension.php");
|
||||
TestUtils.ensureContainsFile(files, output, "docs/Api/DefaultApiInterface.md");
|
||||
TestUtils.ensureContainsFile(files, output, "OpenAPIServerBundle.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Resources/config/routing.yaml");
|
||||
TestUtils.ensureContainsFile(files, output, "Resources/config/services.yaml");
|
||||
TestUtils.ensureContainsFile(files, output, "Service/JmsSerializer.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Service/SerializerInterface.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Service/StrictJsonDeserializationVisitor.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Service/StrictJsonDeserializationVisitorFactory.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Service/SymfonyValidator.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Service/TypeMismatchException.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Service/ValidatorInterface.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Tests/Api/DefaultApiInterfaceTest.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Tests/AppKernel.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Tests/Controller/ControllerTest.php");
|
||||
TestUtils.ensureContainsFile(files, output, "Tests/test_config.yaml");
|
||||
|
||||
output.deleteOnExit();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGeneratePingWithDifferentSourceDirectory() throws Exception {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(AbstractPhpCodegen.SRC_BASE_PATH, "src");
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("php-symfony")
|
||||
.setAdditionalProperties(properties)
|
||||
.setInputSpec("src/test/resources/3_0/ping.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
final ClientOptInput clientOptInput = configurator.toClientOptInput();
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(clientOptInput).generate();
|
||||
|
||||
Assert.assertEquals(files.size(), 33);
|
||||
TestUtils.ensureContainsFile(files, output, ".coveralls.yml");
|
||||
TestUtils.ensureContainsFile(files, output, ".gitignore");
|
||||
TestUtils.ensureContainsFile(files, output, ".openapi-generator-ignore");
|
||||
TestUtils.ensureContainsFile(files, output, ".openapi-generator/FILES");
|
||||
TestUtils.ensureContainsFile(files, output, ".openapi-generator/VERSION");
|
||||
TestUtils.ensureContainsFile(files, output, ".php_cs.dist");
|
||||
TestUtils.ensureContainsFile(files, output, ".travis.yml");
|
||||
TestUtils.ensureContainsFile(files, output, "autoload.php");
|
||||
TestUtils.ensureContainsFile(files, output, "composer.json");
|
||||
TestUtils.ensureContainsFile(files, output, "git_push.sh");
|
||||
TestUtils.ensureContainsFile(files, output, "phpunit.xml.dist");
|
||||
TestUtils.ensureContainsFile(files, output, "README.md");
|
||||
TestUtils.ensureContainsFile(files, output, "docs/Api/DefaultApiInterface.md");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Api/ApiServer.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Api/DefaultApiInterface.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Controller/Controller.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Controller/DefaultController.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/DependencyInjection/Compiler/OpenAPIServerApiPass.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/DependencyInjection/OpenAPIServerExtension.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/OpenAPIServerBundle.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Resources/config/routing.yaml");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Resources/config/services.yaml");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Service/JmsSerializer.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Service/SerializerInterface.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Service/StrictJsonDeserializationVisitor.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Service/StrictJsonDeserializationVisitorFactory.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Service/SymfonyValidator.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Service/TypeMismatchException.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Service/ValidatorInterface.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Tests/Api/DefaultApiInterfaceTest.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Tests/AppKernel.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Tests/Controller/ControllerTest.php");
|
||||
TestUtils.ensureContainsFile(files, output, "src/Tests/test_config.yaml");
|
||||
|
||||
output.deleteOnExit();
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
!var/sessions/.gitkeep
|
||||
|
||||
# Parameters
|
||||
/app/config/parameters.yml
|
||||
/app/config/parameters.yaml
|
||||
/app/config/parameters.ini
|
||||
|
||||
# Managed by Composer
|
||||
|
@ -20,17 +20,8 @@ Model/Tag.php
|
||||
Model/User.php
|
||||
OpenAPIServerBundle.php
|
||||
README.md
|
||||
Resources/config/routing.yml
|
||||
Resources/config/services.yml
|
||||
Resources/docs/Api/PetApiInterface.md
|
||||
Resources/docs/Api/StoreApiInterface.md
|
||||
Resources/docs/Api/UserApiInterface.md
|
||||
Resources/docs/Model/ApiResponse.md
|
||||
Resources/docs/Model/Category.md
|
||||
Resources/docs/Model/Order.md
|
||||
Resources/docs/Model/Pet.md
|
||||
Resources/docs/Model/Tag.md
|
||||
Resources/docs/Model/User.md
|
||||
Resources/config/routing.yaml
|
||||
Resources/config/services.yaml
|
||||
Service/JmsSerializer.php
|
||||
Service/SerializerInterface.php
|
||||
Service/StrictJsonDeserializationVisitor.php
|
||||
@ -40,8 +31,17 @@ Service/TypeMismatchException.php
|
||||
Service/ValidatorInterface.php
|
||||
Tests/AppKernel.php
|
||||
Tests/Controller/ControllerTest.php
|
||||
Tests/test_config.yml
|
||||
Tests/test_config.yaml
|
||||
autoload.php
|
||||
composer.json
|
||||
docs/Api/PetApiInterface.md
|
||||
docs/Api/StoreApiInterface.md
|
||||
docs/Api/UserApiInterface.md
|
||||
docs/Model/ApiResponse.md
|
||||
docs/Model/Category.md
|
||||
docs/Model/Order.md
|
||||
docs/Model/Pet.md
|
||||
docs/Model/Tag.md
|
||||
docs/Model/User.md
|
||||
git_push.sh
|
||||
phpunit.xml.dist
|
||||
|
@ -47,7 +47,7 @@ class OpenAPIServerExtension extends Extension
|
||||
public function load(array $configs, ContainerBuilder $container): void
|
||||
{
|
||||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
$loader->load('services.yaml');
|
||||
}
|
||||
|
||||
public function getAlias(): string
|
||||
|
@ -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
|
||||
|
@ -24,6 +24,6 @@ class AppKernel extends Kernel
|
||||
*/
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
$loader->load(__DIR__.'/test_config.yml');
|
||||
$loader->load(__DIR__.'/test_config.yaml');
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
imports:
|
||||
- { resource: "../Resources/config/services.yml" }
|
||||
- { resource: "../Resources/config/services.yaml" }
|
||||
|
||||
framework:
|
||||
secret: "testsecret"
|
||||
test: ~
|
||||
router:
|
||||
resource: "%kernel.project_dir%/Resources/config/routing.yml"
|
||||
resource: "%kernel.project_dir%/Resources/config/routing.yaml"
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* After registering this autoload function with SPL, the following line
|
||||
* would cause the function to attempt to load the \OpenAPI\Server\Baz\Qux class
|
||||
* from /path/to/project/./Baz/Qux.php:
|
||||
* from /path/to/project/Baz/Qux.php:
|
||||
*
|
||||
* new \OpenAPI\Server\Baz\Qux;
|
||||
*
|
||||
@ -30,7 +30,7 @@ spl_autoload_register(function ($class) {
|
||||
$prefix = 'OpenAPI\\Server\\';
|
||||
|
||||
// base directory for the namespace prefix
|
||||
$base_dir = __DIR__ . '/./';
|
||||
$base_dir = __DIR__ . '/';
|
||||
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
|
@ -33,7 +33,7 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OpenAPI\\Server\\" : "./"
|
||||
"OpenAPI\\Server\\" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ Method | HTTP request | Description
|
||||
|
||||
## Service Declaration
|
||||
```yaml
|
||||
# config/services.yml
|
||||
# config/services.yaml
|
||||
services:
|
||||
# ...
|
||||
Acme\MyBundle\Api\PetApi:
|
@ -12,7 +12,7 @@ Method | HTTP request | Description
|
||||
|
||||
## Service Declaration
|
||||
```yaml
|
||||
# config/services.yml
|
||||
# config/services.yaml
|
||||
services:
|
||||
# ...
|
||||
Acme\MyBundle\Api\StoreApi:
|
@ -16,7 +16,7 @@ Method | HTTP request | Description
|
||||
|
||||
## Service Declaration
|
||||
```yaml
|
||||
# config/services.yml
|
||||
# config/services.yaml
|
||||
services:
|
||||
# ...
|
||||
Acme\MyBundle\Api\UserApi:
|
@ -9,9 +9,9 @@
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">././Api</directory>
|
||||
<directory suffix=".php">././Model</directory>
|
||||
<directory suffix=".php">././Controller</directory>
|
||||
<directory suffix=".php">./Api</directory>
|
||||
<directory suffix=".php">./Model</directory>
|
||||
<directory suffix=".php">./Controller</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
|
Loading…
x
Reference in New Issue
Block a user