68 Commits

Author SHA1 Message Date
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
William DURAND
39dd41e285 Merge pull request #388 from yoshz/feature/body_format
Added configuration to disable body formats
2014-06-25 10:30:56 +02: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
b48650a9e0 Fix CS 2014-06-25 08:52:01 +02:00
Yosh de Vos
624802b57a Added configuration to disable body formats 2014-05-21 15:59:55 +02:00
Yosh de Vos
8402c748ee Added request formats configuration 2014-05-18 21:25:30 +02:00
William DURAND
4b6efc6631 Fix undefined index in AbstractFormatter 2013-12-16 16:47:21 +01:00
William DURAND
d7fd929379 Fix CS 2013-11-14 10:33:57 +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
Josh Hall-Bachner
a9f0613cee Added a configuration parameter to determine the default body format. 2013-06-04 15:30:07 -07:00
Pierre-Yves LEBECQ
13efea8975 Added support for the jms version annotations in formatters 2013-05-12 14:54:01 +02:00
Ismael Ambrosi
0c2cad6f0a Added check for deprecated setting
Avoids adding the method as deprecated if the value of the deprecated setting is false
2013-05-08 11:00:44 -03:00
Patryk Szlagowski
0eb538083a motd configuration 2013-04-08 11:44:43 +02:00
Patryk Kala
3b6e9da91a Ability to mark function as deprecated 2013-03-31 20:35:46 +02:00
Pierre-Yves LEBECQ
67db76990e [Formatter] Fixed MarkdownFormatter. 2013-03-21 14:36:52 +01:00
William DURAND
2fd3f33ad8 Fix 8c9b8331d066269d48ca374280937be264767ee6
* tests
* CS
2013-03-17 16:40:39 +01:00
William DURAND
8c9b8331d0 Merge pull request #138 from drgomesp/section-grouping
Section grouping
2013-03-17 16:13:56 +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
Greg Holland
62b30fdb87 Fix spacing & indentation 2013-01-08 16:38:52 -08:00
Greg Holland
fef40329a4 Add a config option for a default sandbox accept header 2012-12-11 17:59:03 -08:00
William DURAND
b31d439dac Fix tests 2012-11-17 18:09:38 +01:00
William DURAND
84c82f3b94 Allow HtmlFormatter to be overrided 2012-11-17 17:41:12 +01:00
William DURAND
47112613e8 Refactor formatter, avoid code duplication 2012-11-17 17:41:12 +01:00
Vyacheslav Slinko
52df5ebf47 Allow to configure default request format 2012-10-17 15:27:20 +04:00
Vyacheslav Slinko
3540bcfcd8 Make response format more configurable 2012-10-17 15:15:35 +04:00
Vyacheslav Slinko
8e03ef99fa Make JSON declaration method configurable 2012-10-16 23:41:16 +04: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
Evan Villemez
0d7c2272bc updated documentation to reflect return property, updated markdown formatter tests to reflect parameter readonly property 2012-08-28 16:43:47 -04:00
Evan Villemez
504d5125f9 finished up, tests passing, fixed cs 2012-08-27 13:25:03 -04:00
Alexander
fc5b8c4e63 Add optional api_key parameter to sandbox 2012-08-23 16:53:08 +02:00
Evan Villemez
b9e8d61082 changed inputClass to input, refactored method and class names accordingly, fixed cs in several places 2012-07-23 15:44:37 -04:00
William DURAND
a8e0b24b95 Fix tests, fix markdown/html requirements output 2012-07-20 02:02:45 +02: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
William DURAND
bee518f92e Allow to disable the sandbox, refactor the configuration. Fix #37 2012-07-18 13:21:31 +02:00
William DURAND
208d25f825 Dump all assets in order to correctly render the generated HTML page, even in offline mode. Fix #42 2012-07-18 12:56:11 +02:00
William DURAND
e7152678a7 Fix tests 2012-07-18 12:46:22 +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
William DURAND
fce0f5d5a6 Fix extractor, markdown formatter, and tests 2012-07-13 15:31:53 +02:00
William DURAND
3ec87522b2 Add markdown transformation in HTML output, fix Markdown formatter 2012-07-13 15:31:53 +02:00
Samuel Gordalina
07e6a19dd4 Updated code to pass the tests 2012-07-13 15:31:53 +02:00
Samuel Gordalina
2b02733ee9 Added ability to extract inline documentation from docblock 2012-07-13 13:44:11 +01:00
William DURAND
519b356374 Merge branch '1.0.x'
Conflicts:
	Form/Extension/DescriptionFormTypeExtension.php
	Parser/FormTypeParser.php
	Tests/Fixtures/Form/TestType.php
2012-06-27 10:15:57 +02:00