46 Commits

Author SHA1 Message Date
Bez Hermoso
882f658599 Added 'default' parameters in {JmsMetadata,Validator}Parser, and FOSRestHandler. 2014-06-27 10:19:28 +02:00
William Durand
0d1bde9f8a Merge pull request #352 from sroze/output-post-parser
Add PostParserInterface to JmsMetadataParser to get ValidatorParser found children parsed
2014-06-27 10:14:51 +02:00
Bez Hermoso
3a31c93c94 Unified data types [actualType and subType]
Updated tests.

JMS parsing fixes; updated {Validator,FormType}Parser, FOSRestHandler, and AbstractFormatter, and updated DataTypes enum.

Modified dataType checking.

Updated tests.

Updated DataTypes enum.

Quick fix and added doc comments.

CS fixes.

Refactored FormTypeParser to produce nested parameters. Updated tests accordingly.

Logical and CS fixes.

Sub-forms and more tests.

Ignore data_class and always use form-type to avoid conflicts.

Quick fix.
2014-06-27 09:35:18 +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
Samuel ROZE
3f66888f00 Add PostParserInterface to JmsMetadataParser to get ValidatorParser found children parsed. 2014-03-20 16:39:36 +01:00
Paweł Mikołajczuk
32e37dbd8a Don't try to call class with custom handlers.
With JMS Serializer you can set up own type and use it later with custom handler for this property - Parser allways try to call that custom property type like a class. This fix that.
2014-02-03 16:57:46 +01:00
Julius Beckmann
0845377300 Use only JMS/GroupExclusion if groups are there
When no groups are given in the ApiDoc, there should be no GroupExclusion and the Entity should be parsed wihtout exclusions.

Otherwise only the "Default" group of the Entity would be parsed, which may not be used.

The ApiDoc should not enforce the Entity to be grouped with "Default", to generate a "full-view" of it.
2013-12-20 15:08:26 +01:00
William Durand
357d1ff967 Merge pull request #262 from skler/issue-259-2
[FIX] Issue 259
2013-11-14 01:47:29 -08:00
William DURAND
d7fd929379 Fix CS 2013-11-14 10:33:57 +01:00
Mauro Foti
018860205c [FIX] Issue 259 2013-10-11 18:29:10 +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
Pierre-Yves LEBECQ
13efea8975 Added support for the jms version annotations in formatters 2013-05-12 14:54:01 +02:00
fieg
06271f824a added support for JMS Serializer GroupsExclusionStrategy 2013-05-12 14:29:36 +02:00
Tobias Schultze
d2cd56dafc fix jms metadata parser for hashmaps: array<K, V> 2013-05-10 19:09:57 +02:00
marapper
a97c65da70 Make parameters description conform to others 2013-05-07 23:11:32 +04:00
Jordan Stout
d099ffa40f use serializer naming strategy for parameter names 2013-03-25 14:40:00 -07:00
Pierre-Yves LEBECQ
7c6c1d5ce0 [Parser] Added float in JmsMetadataParser::isPrimitive(). 2013-03-20 11:16:20 +01:00
William DURAND
3fe7e15f58 Merge pull request #121 from relaxnow/feature/issue-109-pr2
Issue-109: Fixed infinite recursion on JMS Types that reference themselves or their parents
2013-03-16 18:50:45 +01:00
Stefano Sala
f5c938dc02 [JmsMetadataParser] added support for ArrayCollection 2013-02-26 19:24:14 +01:00
Jordi Boggiano
f162311a16 CS fix 2013-02-15 13:32:51 +01:00
Stefano Sala
5213b7db71 Fixed version of rest-bundle
Removed check of type string
2013-02-15 10:48:29 +01:00
Stefano Sala
5acf1adced Just fixed some docblock 2013-02-15 09:24:09 +01:00
Stefano Sala
07bb37ac76 Finish upgrade to jms serializer 1.0
Updated deprecated MinLength assertion to Length
Updated array of object parsing
Handled deprecated calls because of using
AbstractType (not sure if it is the best way, though)
2013-02-11 14:42:17 +01:00
Boy Baukema
fe76b6df67 Fixed infinite recursion on JMS Types that reference themselves or their parents. 2012-12-20 10:12:50 +01:00
Lukas Kahwe Smith
befeeb3e3f JMSSerializerBundle 1.0 compatibility 2012-12-04 10:27:33 +01:00
Doug Hurst
b42db62be2 #102 - Doh, PHP is not Python 2012-11-26 12:37:44 -06:00
Doug Hurst
035ebfc965 #102 - Fix for JMS @Type change 2012-11-26 12:27:27 -06:00
Jordi Boggiano
9c7577f7c2 Merge remote-tracking branch 'docteurklein/virtual_property_support' 2012-10-24 15:38:42 +02:00
Klein Florian
197cdfc989 fix cs 2012-10-24 15:36:41 +02:00
Klein Florian
d129db9a53 add virtual property support for jms parser 2012-10-24 15:09:36 +02:00
Klein Florian
db4a375992 avoid infinite recursion when parsing jms metadata 2012-10-24 10:29:08 +02:00
Evan Villemez
a8b656f3a0 fixed cs 2012-09-10 09:46:52 -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
8c3466f6ed abstracted docblock comment extraction, implemented in JmsMetadataParser to get parameter descriptions 2012-08-31 14:57:42 -04:00
Evan Villemez
0af506f151 resolved conflicts 2012-08-28 14:50:40 -04:00
Evan Villemez
504d5125f9 finished up, tests passing, fixed cs 2012-08-27 13:25:03 -04:00
Evan Villemez
ea3fb69627 fixed cs 2012-08-27 12:25:18 -04:00
Evan Villemez
01fce41a0e more accurate reporting of arrays and their types 2012-08-27 12:23:23 -04:00
Evan Villemez
d4fe982300 rebased, fixed cs 2012-08-27 12:23:23 -04:00
Evan Villemez
9b94ae4b2c fixed cs 2012-08-27 12:23:23 -04:00
Evan Villemez
185d0e588b updated JMSMetadataParser to support nested models 2012-08-27 12:23:22 -04:00
Evan Villemez
be3cbb5ba3 fixed potential error in JmsMetadataParser::supports 2012-08-27 12:11:43 -04:00
Evan Villemez
1cf7e18d61 fixed README, other minor things 2012-08-08 10:21:56 -04:00
Evan Villemez
68767f6c72 fixed cs 2012-08-07 21:57:36 -04:00
Evan Villemez
149f282481 tests passing with JmsMetadataParser, but work still to do on required and description properties 2012-08-07 21:47:33 -04:00
Evan Villemez
b71bc8bf3f started on implementing JmsMetadataParser and tests 2012-08-07 17:50:58 -04:00