mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Improve doc format
This commit is contained in:
parent
5de5d530dd
commit
38a3137465
@ -242,7 +242,8 @@ You can specify one or more _view_ names under which the method will be
|
|||||||
visible.
|
visible.
|
||||||
|
|
||||||
An example:
|
An example:
|
||||||
```
|
|
||||||
|
```php
|
||||||
/**
|
/**
|
||||||
* A resource
|
* A resource
|
||||||
*
|
*
|
||||||
@ -315,7 +316,7 @@ Strategy](http://jmsyst.com/libs/serializer/master/cookbook/exclusion_strategies
|
|||||||
you can specify which groups to use when generating the documentation by using
|
you can specify which groups to use when generating the documentation by using
|
||||||
this syntax :
|
this syntax :
|
||||||
|
|
||||||
```
|
```php
|
||||||
input={
|
input={
|
||||||
"class"="Acme\Bundle\Entity\User",
|
"class"="Acme\Bundle\Entity\User",
|
||||||
"groups"={"update", "public"}
|
"groups"={"update", "public"}
|
||||||
@ -340,7 +341,7 @@ Even if you use `FormFactoryInterface::createNamed('', 'your_form_type')` the do
|
|||||||
|
|
||||||
You can specify which prefix to use with the `name` key in the `input` section:
|
You can specify which prefix to use with the `name` key in the `input` section:
|
||||||
|
|
||||||
```
|
```php
|
||||||
input = {
|
input = {
|
||||||
"class" = "your_form_type",
|
"class" = "your_form_type",
|
||||||
"name" = ""
|
"name" = ""
|
||||||
@ -348,7 +349,8 @@ input = {
|
|||||||
```
|
```
|
||||||
|
|
||||||
You can also add some options to pass to the form. You just have to use the `options` key:
|
You can also add some options to pass to the form. You just have to use the `options` key:
|
||||||
```
|
|
||||||
|
```php
|
||||||
input = {
|
input = {
|
||||||
"class" = "your_form_type",
|
"class" = "your_form_type",
|
||||||
"options" = {"method" => "PUT"},
|
"options" = {"method" => "PUT"},
|
||||||
@ -361,7 +363,7 @@ By default, all registered parsers are used, but sometimes you may want to
|
|||||||
define which parsers you want to use. The `parsers` attribute is used to
|
define which parsers you want to use. The `parsers` attribute is used to
|
||||||
configure a list of parsers that will be used:
|
configure a list of parsers that will be used:
|
||||||
|
|
||||||
```
|
```php
|
||||||
output={
|
output={
|
||||||
"class" = "Acme\Bundle\Entity\User",
|
"class" = "Acme\Bundle\Entity\User",
|
||||||
"parsers" = {
|
"parsers" = {
|
||||||
@ -393,6 +395,7 @@ documentation if available.
|
|||||||
|
|
||||||
This bundle provides a sandbox mode in order to test API methods. You can
|
This bundle provides a sandbox mode in order to test API methods. You can
|
||||||
configure this sandbox using the following parameters:
|
configure this sandbox using the following parameters:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
nelmio_api_doc:
|
nelmio_api_doc:
|
||||||
@ -483,6 +486,7 @@ nelmio_api_doc:
|
|||||||
### Caching
|
### Caching
|
||||||
|
|
||||||
It is a good idea to enable the internal caching mechanism on production:
|
It is a good idea to enable the internal caching mechanism on production:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
nelmio_api_doc:
|
nelmio_api_doc:
|
||||||
@ -494,12 +498,14 @@ Configuration In-Depth
|
|||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
You can specify your own API name:
|
You can specify your own API name:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
nelmio_api_doc:
|
nelmio_api_doc:
|
||||||
name: My API
|
name: My API
|
||||||
```
|
```
|
||||||
You can choose between different authentication methods:
|
You can choose between different authentication methods:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
nelmio_api_doc:
|
nelmio_api_doc:
|
||||||
@ -526,6 +532,7 @@ When choosing an `http` delivery, `name` defaults to `Authorization`,
|
|||||||
and the header value will automatically be prefixed by the corresponding type (ie. `Basic` or `Bearer`).
|
and the header value will automatically be prefixed by the corresponding type (ie. `Basic` or `Bearer`).
|
||||||
|
|
||||||
You can specify which sections to exclude from the documentation generation:
|
You can specify which sections to exclude from the documentation generation:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
nelmio_api_doc:
|
nelmio_api_doc:
|
||||||
@ -541,6 +548,7 @@ instead.
|
|||||||
The bundle provides a way to register multiple `input` parsers. The first parser
|
The bundle provides a way to register multiple `input` parsers. The first parser
|
||||||
that can handle the specified input is used, so you can configure their
|
that can handle the specified input is used, so you can configure their
|
||||||
priorities via container tags. Here's an example parser service registration:
|
priorities via container tags. Here's an example parser service registration:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
services:
|
services:
|
||||||
@ -551,6 +559,7 @@ services:
|
|||||||
```
|
```
|
||||||
You can also define your own motd content (above methods list). All you have to
|
You can also define your own motd content (above methods list). All you have to
|
||||||
do is add to configuration:
|
do is add to configuration:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
nelmio_api_doc:
|
nelmio_api_doc:
|
||||||
@ -558,7 +567,9 @@ nelmio_api_doc:
|
|||||||
motd:
|
motd:
|
||||||
template: AcmeApiBundle::Components/motd.html.twig
|
template: AcmeApiBundle::Components/motd.html.twig
|
||||||
```
|
```
|
||||||
|
|
||||||
You can define an alternate location where the ApiDoc configurations are to be cached:
|
You can define an alternate location where the ApiDoc configurations are to be cached:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# app/config/config.yml
|
# app/config/config.yml
|
||||||
nelmio_api_doc:
|
nelmio_api_doc:
|
||||||
@ -581,6 +592,7 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: nelmio_api_doc.extractor.handler }
|
- { name: nelmio_api_doc.extractor.handler }
|
||||||
```
|
```
|
||||||
|
|
||||||
Look at the built-in [Handlers](https://github.com/nelmio/NelmioApiDocBundle/tree/master/Extractor/Handler).
|
Look at the built-in [Handlers](https://github.com/nelmio/NelmioApiDocBundle/tree/master/Extractor/Handler).
|
||||||
|
|
||||||
### Configuration Reference
|
### Configuration Reference
|
||||||
|
Loading…
x
Reference in New Issue
Block a user