157 Commits

Author SHA1 Message Date
Bez Hermoso
928a23e2c8 Updated regex pattern matching and added tests for parsing array<..> directives. 2014-09-04 10:47:57 -07:00
Bez Hermoso
f5c1b06807 Support for collections. 2014-09-04 10:47:57 -07:00
Loick Piera
16b104edec Added support for Security annotation 2014-08-28 00:12:34 +02:00
thenetexperts
e1c7e8a5bd adding optional color codes for tags annotation 2014-08-25 11:27:49 +02:00
Samuel ROZE
3e3ef87b79 Added nested JMS groups exclusion 2014-08-18 11:32:36 +02:00
Bez Hermoso
b7f5fb58d4 Added definition when is provided. 2014-08-04 10:58:41 -07:00
Bez Hermoso
cc0d445601 Added caching layer with the controllers and routing files as resources. 2014-07-31 00:43:59 -07:00
William Durand
75eb7ca356 Merge pull request #418 from bezhermoso/swagger
Swagger support
2014-07-30 11:23:46 +02:00
William DURAND
6c7c53e78d Fix CS & file permissions 2014-07-30 10:50:23 +02:00
Bez Hermoso
07c6557fc5 Test fixes. 2014-07-29 10:25:06 -07:00
Bez Hermoso
9824a6ba3c Added default value handling. 2014-07-29 10:25:06 -07:00
Bez Hermoso
abaeb374e8 Added 'type' to API item if applicable. 2014-07-29 10:25:06 -07:00
Bez Hermoso
bb723bdb40 Added new tests for Swagger doc controllers. Also some CS fixes. 2014-07-29 10:25:06 -07:00
Bez Hermoso
6f85aed33c Swagger support:
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.
Logical and CS fixes.
Swagger support: created formatter.
Configuration and resourcePath logic update.
ApiDoc annotation update. Updated formatter and added tests.
Parameter formatting.
Added tests for SwaggerFormatter.
Added  option in annotation, and the corresponding logic for parsing the supplied values and processing them in the formatter.
Routing update.
Updated tests.
Removed unused dependency and updated doc comments.
Renamed 'responseModels' to 'responseMap'
Update the resource filtering and formatting of response messages.
Updated check for 200 response model.
Ignore data_class and always use form-type to avoid conflicts.
Fix: add 'type' even if '' is specified.
Refactored responseMap; added parsedResponseMap. Added tests and updated some.
Fix: add 'type' even if '' is specified.
Initial commit of command.
Finished logic for dumping files.
Updated doc comment; added license and added more meaningful class comment.

Array of models support.
2014-07-29 10:25:05 -07: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
William DURAND
0030ce6825 Merge pull request #358 from pborreli/typos 2014-06-27 10:22:56 +02:00
Pascal Borreli
dbc3fcbb73 Fixed typos 2014-06-27 10:22:36 +02:00
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
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
Even André Fiskvik
b4e874e2dc Add support for nullable option in RequestParam 2014-06-25 10:19:30 +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
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
Sandro Meier
dfd094371d Implement Tags for functions. 2014-05-27 13:33:50 +02:00
Loick Piera
d0149c65ab fix #357 2014-05-16 22:04:24 +02:00
William DURAND
fa92011126 fix cs 2014-05-16 11:33:58 +02:00
Max Romanovsky
b4fa6013cd Form Parser improvements for date, datetime & choice form types (format & types) 2014-04-04 13:52:12 +03:00
Samuel ROZE
3f66888f00 Add PostParserInterface to JmsMetadataParser to get ValidatorParser found children parsed. 2014-03-20 16:39:36 +01:00
Julius Beckmann
56f8c43849 Added PHP 5.6 and HHVM to Travis.
Modified RequestListenerTest so it does not use the Crawler, that currently does not work with HHVM.
2014-03-03 18:44:37 +01:00
jdeveloper
dea78901a0 Added exclude_envs to ApiDoc annotation to exclude the documentation from the specified environments 2014-01-20 13:24:41 +01:00
Simon Schick
912178dc88 Hide “_scheme” in the list of requirements per URL
+ disable sandbox if the scheme of the URL doesn’t match the scheme, the
documentation is opened in
2013-12-28 18:52:32 +01:00
William DURAND
627130637d Merge PR #288 from piotrantosik/feature/selectparsers 2013-12-28 18:42:51 +01:00
Piotr Antosik
3fdbfbed1c select used parsers 2013-12-28 18:41:59 +01:00
William DURAND
af7c04cdfc Merge PR #298 from 'skler/extended_class 2013-12-28 18:28:07 +01:00
William DURAND
dc9c706b51 [Test] Extended Class test case 2013-12-28 18:27:48 +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
Samuel ROZE
1112cca784 Add support of All constraint 2013-11-18 10:24:56 +01:00
Samuel ROZE
184a364fa4 Merge output parameters 2013-11-16 17:29:23 +01:00
William DURAND
e59ae1e1ef Fix tests for Symfony2 2.1 2013-11-14 14:20:51 +01:00
William DURAND
3ce5dca429 Fix a failing test 2013-11-14 13:26:10 +01:00
William DURAND
87328e27f5 Merge pull request #206 from dothiv/master
Show authorized roles in key icon tooltip
2013-11-14 11:17:06 +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
Jordi Boggiano
769b435cf3 Test suite cleanups 2013-10-29 14:41:13 +01:00
David de Boer
fbe9488963 Add support for embedded forms 2013-10-23 15:45:30 +02:00
Konrad Podgórski
74d30d9e39 Option to set requirements and parameters directly from ApiDoc annotation
Sometimes required parameters are not used through routing but still they are mandatory. I wanted to have API with

resource.json?foo=bar&something=else

format, that was possible through QueryParam annotation or requirements in routing BUT!

There was no way to set dataType or description

This PR solves problem for me.

Side note: if you want to declare e.g. _format requirement through Annotation or any other param that is used in url ({foo} format) then it won't work. Because Bundle still overrides requirements and parameters after the constuctor in ApiDoc is called. This might be solved in separate PR by adding check if given requirements or parameters was already defined.
2013-10-15 15:28:54 +02:00