forked from loafle/openapi-generator-original
* Fix error in Symfony models #5985 * Parse Symfony params #5985 * Implement auth metods in Symfony #5985 * Make "get" to "is" in Symfony's booleans #5985 * Use `camelize` instead of `initialCaps` in Symfony #5985 * Use File.separator instead of "/" in PHP/Symfony #5985 * Improve README generation for Symfony #5985 * Create an options test for Symfony #5985
98 lines
3.5 KiB
Plaintext
98 lines
3.5 KiB
Plaintext
# {{apiPackage}}\{{classname}}{{#description}}
|
|
{{description}}{{/description}}
|
|
|
|
All URIs are relative to *{{basePath}}*
|
|
|
|
Method | HTTP request | Description
|
|
------------- | ------------- | -------------
|
|
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
|
{{/operation}}{{/operations}}
|
|
|
|
{{#operations}}
|
|
## Service Declaration
|
|
```yaml
|
|
# src/Acme/MyBundle/Resources/services.yml
|
|
services:
|
|
# ...
|
|
acme.my_bundle.api.{{pathPrefix}}:
|
|
class: Acme\MyBundle\Api\{{baseName}}Api
|
|
tags:
|
|
- { name: "{{bundleAlias}}.api", api: "{{pathPrefix}}" }
|
|
# ...
|
|
```
|
|
|
|
{{#operation}}
|
|
## **{{{operationId}}}**
|
|
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
|
|
|
{{{summary}}}{{#notes}}
|
|
|
|
{{{notes}}}{{/notes}}
|
|
|
|
### Example Implementation
|
|
```php
|
|
<?php
|
|
// src/Acme/MyBundle/Api/{{classname}}.php
|
|
|
|
namespace Acme\MyBundle\Api;
|
|
|
|
use {{apiPackage}}\{{classname}};
|
|
|
|
class {{baseName}}Api implements {{classname}}
|
|
{
|
|
{{#authMethods}}{{#isApiKey}}
|
|
/**
|
|
* Configure API key authorization: {{{name}}}
|
|
*/
|
|
public function set{{name}}($apiKey)
|
|
{
|
|
// Retrieve logged in user from $apiKey ...
|
|
}
|
|
{{/isApiKey}}{{#isOAuth}}
|
|
/**
|
|
* Configure OAuth2 access token for authorization: {{{name}}}
|
|
*/
|
|
public function set{{name}}($oauthToken)
|
|
{
|
|
// Retrieve logged in user from $oauthToken ...
|
|
}
|
|
{{/isOAuth}}{{/authMethods}}
|
|
// ...
|
|
|
|
/**
|
|
* Implementation of {{classname}}#{{operationId}}
|
|
*/
|
|
public function {{operationId}}({{#allParams}}{{#vendorExtensions.x-parameterType}}{{vendorExtensions.x-parameterType}} {{/vendorExtensions.x-parameterType}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
|
{
|
|
// Implement the operation ...
|
|
}
|
|
|
|
// ...
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
|
Name | Type | Description | Notes
|
|
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
|
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}
|
|
{{/allParams}}
|
|
|
|
### Return type
|
|
|
|
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**](../Model/{{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
|
|
|
|
### Authorization
|
|
|
|
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
|
|
|
|
### HTTP request headers
|
|
|
|
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
|
- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
|
|
|
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
|
|
|
{{/operation}}
|
|
{{/operations}}
|