FriendsOfSymfony / FOSRestBundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony
http://symfony.com/doc/master/bundles/FOSRestBundle/index.html
MIT License
2.79k stars 703 forks source link

expose:true annotation and routing.yml doesnt works / not forward options IIRC #718

Closed Bup3 closed 9 years ago

Bup3 commented 10 years ago

Hello,

I have a problem with the routing.yml or @Route() annotation.

I'm using this annotation.

* @Route(options={"expose"=true})

and this routing.yml.

acme_demo_api_test:
    type: rest
    resource: Acme\DemoBundle\Controller\TestController
    name_prefix: api_
    prefix: /api
    options:
        expose: true

And php app/console fos:js-routing:debug is:

[router] Current routes
Name Method Scheme Host Path

php app/console router:debug

Name Method Scheme Host Path
api_test_get GET ANY ANY /api/test

@willdurand said

Yes, that's because the FOSRestBundle's router does not forward options IIRC.

Could you fix that please? :+1:

willdurand commented 10 years ago

I can't really remember but I'm pretty sure someone alrady reported such an issue. I think it is more related to this bundle than the FOSJsRoutingBundle.

lsmith77 commented 10 years ago

the relevant code is here https://github.com/FriendsOfSymfony/FOSRestBundle/tree/master/Routing .. @Bup3 could you have a look .. probably not sooo hard to fix this

hd-deman commented 10 years ago

+1

lsmith77 commented 10 years ago

ping

fbertheuil commented 10 years ago

+1

lsmith77 commented 10 years ago

so anyone up for doing the work? :)

egulias commented 10 years ago

Is this a duplication from https://github.com/FriendsOfSymfony/FOSRestBundle/issues/439 ?

@lsmith77 should implement the expose option when loading the routes, right? ( As used here? https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/blob/master/Extractor/ExposedRoutesExtractor.php#L160) Is there any tests for this? I've been searching but failed to see one.

Thanks!

lsmith77 commented 10 years ago

yeah .. i think its a dupe. and no there are no tests for this as its not a feature provided by the bundle yet

egulias commented 10 years ago

I went to test this implementation with FOSJsRoutingBundle (as suggested by @lsmith77 on the PR), but I first tried to replicate the issue. But I couldn't. The console command fos:js-routing:debug shows the right routes when expose option is used with annotations and with yaml (can we assume that will work with xml then?) With annotation:

sf fos:js-routing:debug
[router] Current routes
 Name  Method Scheme Host Path   
 _demo ANY    ANY    ANY  /demo/ 

With yaml:

fos:js-routing:debug
[router] Current routes
 Name    Method Scheme Host Path                        
 index   GET    ANY    ANY  /api/index.{_format}        
 hello   PATCH  ANY    ANY  /api/{name}/hello.{_format} 
 contact GET    ANY    ANY  /api/contact.{_format}

@Bup3 can you take a look at this?

EmmanuelVella commented 10 years ago

Same issue here, expose option doesn't work with FOSRest routes.

lsmith77 commented 10 years ago

can someone who is facing these issues check https://github.com/FriendsOfSymfony/FOSRestBundle/pull/809 and give feedback?

hd-deman commented 10 years ago

I confirm that #809 works as it should.