Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import ApiProvider & Parser from NelmioApiDocBundle #225

Closed
wants to merge 2 commits into from

Conversation

ogizanagi
Copy link
Contributor

and ensure the compatibility with NelmioApiDoc ^2.9 by removing old provider and parser definitions.

This is a draft on how to proceed to migrate the nelmio api doc extension stuff into the Api bundle.

Note it will not work without nelmio/NelmioApiDocBundle#695 (as currently).

Tests should of course also be ported into the bundle.
Documentation should be updated.

With this PR, the Nelmio API Doc support must be explicitly enabled in the configuration:

# config.yml
dunglas_api:
   nelmio_api_doc: true

The compiler pass is needed in order to ensure the support of NelmioApiDoc ^2.9, until the old provider and parser are removed from the NelmioApiDocBundle.
When a new NelmioApiDoc version is released with those removals, the compiler pass could be removed. Then we'll have something clean for the first api bundle official release.

What do you think ?


Related to #219 and #156

@ogizanagi
Copy link
Contributor Author

nelmio/NelmioApiDocBundle#695 has been merged, but in order to make it work until the next nelmio api doc release, I added a way to hot fix the ApiDocExtractor.

@teohhanhui
Copy link
Contributor

👍

@dunglas
Copy link
Member

dunglas commented Aug 24, 2015

What do you think of this PR @willdurand?

@teohhanhui
Copy link
Contributor

Any updates on this?

@teohhanhui
Copy link
Contributor

maxime.steinhausser added 2 commits October 29, 2015 19:19
and ensure the compatibility with NelmioApiDoc ^2.9 by removing old provider and parser definitions.
@Drachenkaetzchen
Copy link

I just tried the PR which fixes the following error:

ContextErrorException in DunglasApiProvider.php line 48:
Catchable Fatal Error: Argument 3 passed to Nelmio\ApiDocBundle\Extractor\AnnotationsProvider\DunglasApiProvider::__construct() must be an instance of Dunglas\ApiBundle\Mapping\ClassMetadataFactoryInterface, instance of Dunglas\ApiBundle\Mapping\Factory\ClassMetadataFactory given, called in /home/felicitus/public_html/PartKeepr/app/cache/dev/appDevDebugProjectContainer.php on line 3706 and defined

However, no API methods from DunglasApiBundle are now displayed: I'm using dev-master of the NelmioAPIDocBundle ( nelmio/NelmioApiDocBundle@eafa2ad latest as of now) as well as DunglasApiBundle branch nelmio_import (ogizanagi@1ecaed0 latest as of now).

Is this the expected behavior?

@ogizanagi
Copy link
Contributor Author

@FELICITUS : No it isn't. But actually, I've not worked on this PR since its creation, except a quick rebase 19 days ago. I could have a look in the next days.
However, before this, could you please confirm you properly enabled the nelmio_api_doc support in the dunglas_api config ?

dunglas_api:
   nelmio_api_doc: true

@Drachenkaetzchen
Copy link

You're right, I forgot this configuration option, mainly because it's missing from the NelmioApiDocBundle Documentation.

In fact, I'm bitten again by nelmio/NelmioApiDocBundle#678, so I can't test further.

@teohhanhui
Copy link
Contributor

@dunglas No decision on this yet? It'd be great if the master branch is usable without merging this in manually each time...

@teohhanhui
Copy link
Contributor

ping @sroze @theofidry

I still have to merge this into the master branch each time for it to be usable.

@dunglas
Copy link
Member

dunglas commented Jan 20, 2016

Ok to merge it. Can you adopt the bridge structure like in the v2-metadata branch?

@dunglas
Copy link
Member

dunglas commented Jan 20, 2016

It should be merged for master only. Not in v1.

@reminec
Copy link
Contributor

reminec commented Feb 1, 2016

Hi everybody.
I try to work with NelmioApiDocBundle + DunglasApiBundle + Symfony 3.x.
Does it exist a release to works with both of them without issue ?

@dunglas
Copy link
Member

dunglas commented Feb 1, 2016

The 1.1@dev version should work (but some dependencies for using Behat are not ready yet, such as Mink).

@dunglas
Copy link
Member

dunglas commented Feb 1, 2016

For now I still advise you to use Symfony 2.8.

@reminec
Copy link
Contributor

reminec commented Feb 1, 2016

Thank you for your advice.
I try to stay in Symfony 3.*

For now, I get a success on /api/doc with following configuration :

composer.json

     "repositories": [
            {
                "type": "vcs",
                "url": "https://github.com/reminec/DunglasApiBundle.git"
            }
        ],
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.0.*",
        "dunglas/api-bundle": "dev-nelmio_import",
        "nelmio/api-doc-bundle": "^2.9"
    },

My fork is a fork of @ogizanagi branch with 2 fix :

  • Remove the usage of NumericNodeDefinition::cannotBeEmpty()
  • [composer.json] Fix symfony/proxy-manager-bridge 3.x version

Maybe I will be face of some other issues in the future...

@dunglas
Copy link
Member

dunglas commented Feb 1, 2016

Did you use the 1.x or the master branch previously (there is no support for Nelmio yet in master)?

@reminec
Copy link
Contributor

reminec commented Feb 1, 2016

What did you mean by 1.x branch ?
I started from ogizanagi:nelmio_import branch witch start from 1.0.0-beta3 + some rebases..
I will try to rebase from 1.x to see if it works.

Edit : I rebase from master, not 1.x

@ogizanagi
Copy link
Contributor Author

Hi everyone !
Sorry for my lack of answer here. I saw the last updates on the thread, but I let it go out of my head.

@reminec : If you or anyone else can take back my work where I've left it, you'll do me a favour :)

@teohhanhui
Copy link
Contributor

@reminec The nelmio_import branch is based on outdated master (back then it was supposed to become 1.0 but later postponed...)

@ogizanagi I'm willing to take over, as I'm definitely interested in getting this merged. (As you can see, I've been bugging people here for the longest time. Heh...)

@reminec
Copy link
Contributor

reminec commented Feb 2, 2016

Re !
I rebased the ogizanagi:nelmio_import on dunglas:master and then, no need to apply my previous commits.

You can find this at https://github.com/reminec/DunglasApiBundle/tree/nelmio_import

@teohhanhui
Copy link
Contributor

Done in #410

@teohhanhui teohhanhui closed this Mar 19, 2016
@ogizanagi ogizanagi deleted the nelmio_import branch March 19, 2016 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants