38 Commits

Author SHA1 Message Date
Fred Cox
406a4e1b5b Add support for using name in the input and output options for JsonSerializable and validation parsers 2015-07-01 14:05:10 +03:00
Fred Cox
37c6465700 Add a parser for jsonSerializable classes 2015-07-01 14:04:38 +03:00
William Durand
94ba751848
fix CS 2015-05-15 17:42:03 +02:00
Stéphane Reuille
dc20b249e7 fix memory limit issue wirh entity list
Allow to disable mapping of entity list to avoid memory limit error on long list
2015-05-13 14:51:15 +02:00
Kévin Dunglas
79c1c4e4f4 Enhanced DunglasApiBundle support 2015-04-29 09:11:54 +02:00
dtonder
d73531aeb5 - added javascript for collapsing sections in json-response, - fixed usage of private service-alias (that will be removed by RemovePrivateAliases-compiler pass) 2015-03-29 14:37:06 +02:00
Kévin Dunglas
adc03ba26d DunglasJsonLdApiBundle support 2015-03-20 09:53:48 +01:00
pedro
d121e28d69 Add form options to ApiDoc input
Update index.md

Remove unused variable. $arguments is now named $options
2015-03-13 16:15:29 +01:00
Samuel ROZE
3e3ef87b79 Added nested JMS groups exclusion 2014-08-18 11:32:36 +02:00
Sander Marechal
b66e5c4449 Parse JSM\Inline, fixes #372 2014-07-08 13:20:13 +02:00
Giorgio Premi
e2c2d00075 FormTypeParser: FormType constructor should be called when possible 2014-06-27 10:58:53 +02:00
Bez Hermoso
882f658599 Added 'default' parameters in {JmsMetadata,Validator}Parser, and FOSRestHandler. 2014-06-27 10:19:28 +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
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
Christophe Coevoet
8d3fd662bf Fixed the retrieval of the validation MetadataFactory
The service is private so getting it from the container get() method is invalid and it does not work anymore in Symfony 2.5 because the service gets inlined.
2014-06-18 09:38:16 +02:00
Max Romanovsky
b4fa6013cd Form Parser improvements for date, datetime & choice form types (format & types) 2014-04-04 13:52:12 +03: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
e59ae1e1ef Fix tests for Symfony2 2.1 2013-11-14 14:20:51 +01:00
Martin Westergaard Lassen
83315fcc80 Set format according to Date, DateTime and Time annotations 2013-11-14 11:05:05 +01:00
William Durand
29965ec7bb Merge pull request #264 from driebit/embedded-forms
Add support for embedded forms
2013-11-14 01:42:43 -08:00
William DURAND
d7fd929379 Fix CS 2013-11-14 10:33:57 +01:00
David de Boer
fbe9488963 Add support for embedded forms 2013-10-23 15:45:30 +02:00
Adrien Brault
083ae3aef1 Can now specifiy form name
If you create you forms using FormFactoryInterface::createNamed, then you should now be able to tell the ApiDocBundle the correct form prefix.
2013-10-08 12:09:46 -07:00
William Durand
96b40b8a8c Merge pull request #210 from jhallbachner/validation2
Added Support for Validation Component (refactored)
2013-08-13 03:28:09 -07:00
Jordi Boggiano
2a87244869 Fix build 2013-07-05 00:27:42 +02:00
Josh Hall-Bachner
23f64b84f6 Fixed multi-level validation nesting.
Removed "class" parameters from results after processed.

Updated README.
2013-06-30 23:46:43 -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
William Durand
0eb7ec27ec Merge pull request #152 from adriensamson/issue-147
Fix Illegal offset warning in FormTypeParser (closes #147)
2013-06-18 06:44:06 -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
marapper
a97c65da70 Make parameters description conform to others 2013-05-07 23:11:32 +04:00
Jordan Stout
afd07dc570 fixed failing tests 2013-03-26 11:29:50 -07:00
Adrien SAMSON
eef1b7db0a Add tests for FormTypeParser 2013-03-19 15:43:30 +01:00
William DURAND
91a2fc2159 Fix CS 2013-03-16 18:48:34 +01:00
Stefano Sala
f5c938dc02 [JmsMetadataParser] added support for ArrayCollection 2013-02-26 19:24:14 +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
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