33 Commits

Author SHA1 Message Date
Vitaliy Chesnokov
cd87930d29
Check the version in methods response 2019-04-25 21:50:32 +03:00
Adam Prager
7919b24971 Use the response map in the html view 2016-01-26 04:36:38 +01:00
William DURAND
a817081ab2 Add missing array key checks
Fixes #423
2014-06-27 10:07:03 +02:00
Jonathan Chan
d4e12d66f2 Add default values support for form types
Adding displaying default value in Markdown

updating tests to work with new default value
2014-06-26 11:20:49 -04:00
Bez Hermoso
14d1021c8b Unified data types [actualType and subType]
This is the result of https://github.com/nelmio/NelmioApiDocBundle/issues/410.

This PR aims to provide a uniform way of declaring data-types of parameters for
parsers and handlers to follow. In turn, this would allow formatters to
determine data-types in a cleaner and less volatile manner. (See use-case that
can be improved with this PR:
https://github.com/nelmio/NelmioApiDocBundle/blob/master/Formatter/AbstractFormatter.php#L103)

This is possible by the addition two properties to each property item in
`response`, and `parameters` fields in each API endpoint produced by the
`ApiDocExtractor`:

* `actualType` Contains a value from one of the `DataTypes` class constants.

* `subType` Can contain either `null`, or any other `DataTypes` class constant.
This is relevant when the `actualType` is a `DataTypes::COLLECTION`, wherein
`subType` would specify the type of the collection items. It is also relevant
when `actualType` is a `DataTypes::MODEL`, wherein `subType` would contain an
identifier of the model (the FQCN or anything the parser would wish to specify)

Examples:

```php

array(
    'id' => array(
        'dataType' => 'integer',
        'actualType' => DataTypes::INTEGER,
        'subType' => null,
    ),
    'profile' => array(
        'dataType' => 'object (Profile)',
        'actualType' => DataTypes::MODEL,
        'subType' => 'Foo\Entity\Profile',
        'children' => array(
            'name' => array(
                'dataType' => 'string',
                'actualType' => DataTypes::STRING,
                'subType' => null,
             ),
            'birthDate' => array(
                'dataType' => 'date',
                'actualType' => DataTypes::DATE,
                'subType' => null,
            ),
        )
    ),
    'languages' => array(
        'dataType' => 'array of strings',
        'actualType' => DataTypes::COLLECTION,
        'subType' => DataTypes::STRING,
    ),
    'roles' => array(
        'dataType' => 'array of choices',
        'actualType' => DataTypes::COLLECTION,
        'subType' => DataTypes::ENUM,
    ),
    'groups' => array(
        'dataType' => 'array of objects (Group)',
        'actualType' => DataTypes::COLLECTION,
        'subType' => 'Foo\Entity\Group',
    ),
    'profileRevisions' => array(
         'dataType' => 'array of objects (Profile)',
         'actualType' => DataTypes::COLLECTION,
         'subType' => 'Foo\Entity\Profile',
    ),
    'address' => array(
        'dataType' => 'object (a_type_a_custom_JMS_serializer_handler_handles)',
        'actualType' => DataTypes::MODEL,
        'subType' => 'a_type_a_custom_JMS_serializer_handler_handles',
    ),
);
```

When a formatter omits the `dataType` property or leaves it blank, it is
inferred within `ApiDocExtractor` before everything is passed to formatters.
2014-06-25 09:05:48 +02:00
William DURAND
4b6efc6631 Fix undefined index in AbstractFormatter 2013-12-16 16:47:21 +01:00
Kevin Saliou
23bc2b6f47 make api method headers anchor links so a speicif method can be refered to through its unique id 2013-09-06 13:42:19 +02:00
Josh Hall-Bachner
5e1549a29d Built parse-merging into the ApiDocExtractor.
Wired up a "post-parse" pass to allow recursive parsing across multiple parsers.
2013-06-30 23:46:41 -07:00
Josh Hall-Bachner
0913157399 Added the initial structure for a Symfony Validation handler that is injected into the parsers. 2013-06-30 23:46:41 -07:00
Pierre-Yves LEBECQ
13efea8975 Added support for the jms version annotations in formatters 2013-05-12 14:54:01 +02:00
William DURAND
2fd3f33ad8 Fix 8c9b8331d066269d48ca374280937be264767ee6
* tests
* CS
2013-03-17 16:40:39 +01:00
drgomesp
381476a2eb Changed html structure and css for sections 2013-02-25 17:27:09 -03:00
drgomesp
9c601664d1 #138 Added section grouping as a higher level key to the resources array 2013-02-21 15:46:59 -03:00
drgomesp
b4792d1cd5 Changed conditional to work with default value as null 2013-02-14 14:16:54 -02:00
drgomesp
ad4eae7dd7 #25 Added handling of sections on the processCollection method of the AbstractFormatter 2013-02-13 17:08:35 -02:00
William DURAND
47112613e8 Refactor formatter, avoid code duplication 2012-11-17 17:41:12 +01:00
Evan Villemez
29c3798124 implemented nested parameter handling in AbstractFormatter, updated MarkdownFormatter and HtmlFormatter to use it 2012-09-10 09:46:02 -04:00
William DURAND
cca97cf6af Refactoring
Move logic to extract data in the Extractor
Remove logic in the AbstractFormatter
Use ApiDoc class as data container
Update tests
Add test to prove the bug with FOSRestBundle annotations (\\d+ instead of \d+)
2012-07-20 01:32:16 +02:00
Jordi Boggiano
0868d39e9a Merge pull request #43 from willdurand/fix-13
Add support for FOSRest annotations. Fix #13
2012-07-18 03:29:41 -07:00
William DURAND
163d96a295 Add support for FOSRest annotations. Fix #13 2012-07-18 12:23:57 +02:00
William DURAND
e2e647bb03 Merge branch '1.0.x' 2012-07-13 15:32:51 +02:00
Samuel Gordalina
2b02733ee9 Added ability to extract inline documentation from docblock 2012-07-13 13:44:11 +01:00
Christophe Coevoet
fd8ee2679a Added the support of form types defined as services 2012-06-21 00:11:32 +02:00
Christophe Coevoet
04b075736f Applied some php-cs-fixer magic 2012-05-23 00:42:59 +02:00
Adrien BRAULT
be3dca0c47 Add support in docblocks for @param with no description 2012-05-07 12:51:22 +02:00
William DURAND
d1be0d5093 Added parsing of @param doc blocks. Fixes #8 2012-04-19 20:27:27 +02:00
William DURAND
a51d25b94f Used Twig instead of plain PHP in the HtmlFormatter. Fixes #1 2012-04-13 11:25:53 +02:00
Jordi Boggiano
a74520057a Add license 2012-04-13 11:03:05 +02:00
William DURAND
8574982b7b Fixed rendering 2012-04-12 19:17:03 +02:00
William DURAND
f172e74db7 Renamed the bundle 2012-04-12 18:37:42 +02:00
William DURAND
bfaa0c6adf Added a way to group API methods by 'resource' name 2012-04-12 17:24:38 +02:00
William DURAND
72b8976006 [ApiBundle] Refactored formatters to handle both one object, and a collection 2012-04-12 12:49:43 +02:00
William DURAND
aa9504a80c Refactored formatters 2012-04-12 01:28:56 +02:00