Update README.md

This commit is contained in:
William Durand 2013-04-18 01:29:56 +03:00
parent 08eebf0fa0
commit 3c43cc5d07

View File

@ -204,7 +204,7 @@ You can specify your own API name:
# app/config/config.yml # app/config/config.yml
nelmio_api_doc: nelmio_api_doc:
name: My API name: My API
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:
@ -220,15 +220,15 @@ configure this sandbox using the following parameters:
endpoint: http://sandbox.example.com/ # default: /app_dev.php, use this parameter to define which URL to call through the sandbox endpoint: http://sandbox.example.com/ # default: /app_dev.php, use this parameter to define which URL to call through the sandbox
accept_type: application/json # default null, if set, the value is automatically populated as the Accept header accept_type: application/json # default null, if set, the value is automatically populated as the Accept header
The bundle provides a way to register multiple `input` parsers. The first parser that can handle the specified 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 priorities via container tags. Here's an example parser service registration: input is used, so you can configure their priorities via container tags. Here's an example parser service registration:
#app/config/config.yml #app/config/config.yml
services: services:
mybundle.api_doc.extractor.custom_parser: mybundle.api_doc.extractor.custom_parser:
class: MyBundle\Parser\CustomDocParser; class: MyBundle\Parser\CustomDocParser
tags: tags:
- {name: nelmio_api_doc.extractor.parser, priority: 2} - { name: nelmio_api_doc.extractor.parser, priority: 2 }
You can also define your own motd content (above methods list). All you have to do is add to configuration: You can also define your own motd content (above methods list). All you have to do is add to configuration:
@ -236,20 +236,20 @@ You can also define your own motd content (above methods list). All you have to
motd: motd:
template: AcmeApiBundle::Components/motd.html.twig template: AcmeApiBundle::Components/motd.html.twig
## Using your own annotations ## ## Using Your Own Annotations ##
If you have developped your own project-related annotations, and you want to parse them to populate the ApiDoc, If you have developed your own project-related annotations, and you want to parse them to populate
you can provide custom handlers as services. You juste have to implements the the `ApiDoc`, you can provide custom handlers as services. You juste have to implement the
`Nelmio\ApiDocBundle\Extractor\HandlerInterface` and tag it as `nelmio_api_doc.extractor.handler`. `Nelmio\ApiDocBundle\Extractor\HandlerInterface` and tag it as `nelmio_api_doc.extractor.handler`:
#app/config/config.yml # app/config/config.yml
services: services:
mybundle.api_doc.extractor.my_annotation_handler: mybundle.api_doc.extractor.my_annotation_handler:
class: MyBundle\AnnotationHandler\MyAnnotationHandler; class: MyBundle\AnnotationHandler\MyAnnotationHandler
tags: tags:
- {name: nelmio_api_doc.extractor.handler} - { name: nelmio_api_doc.extractor.handler }
Look at examples in [Handlers](https://github.com/nelmio/NelmioApiDocBundle/tree/annotation_handlers/Extractor/Handler) Look at the built-in [Handlers](https://github.com/nelmio/NelmioApiDocBundle/tree/master/Extractor/Handler).
## Credits ## ## Credits ##