Core: Use only ItemOperations but it's does'nt work

Created on 29 Jul 2016  路  11Comments  路  Source: api-platform/core

Hi,

I would like to use only ItemOperation GET on my ItemInfos object, because the CollectionOperations is not revelent. But, if i make this configuration, the service doesn't show on API Doc and doesn't work. Why ?

/**
 * @ApiResource(
 *     collectionOperations={}},
 *     itemOperations={"get"={"method"="GET","path"="/items/info/{id}"}}
 * )
 */

Another strange problem is the path. I don't show this in my page API. Only show:
get /item_infos/{id}

Thank's for your help

Bertrand

question

All 11 comments

Precision: The service work correctly with this syntax. It's a bug in swagger display.

@Simperfit can you take a look?

@Garfield-fr Could you please take a look at @Ener-Getick's PR ? #648

@Simperfit Yes, i tested on master branch and it work.

Thank's

Could you please close this @Garfield-fr ?

I have a strange thing with this PR:

If i use this syntax (without ORM)

/**
 * @ApiResource(
 *     collectionOperations={},
 *     itemOperations={"get"={"method"="GET","path"="/items/info/{id}"}}
 * )
 */

i show element(s) on API Doc and it work.

If i use this (with ORM)

/**
 * @ApiResource(
 *     collectionOperations ={},
 *     itemOperations={"get"={"method"="GET"}}
 * )
 * @ORM\Entity(readOnly=true)
 * @ORM\Table(name="reserve_item")
 */

I don't have this on API Doc and doesn't work.

Thank's

@Garfield-fr this is not related to this pr but to a current limitation of the IriConverter which only works if you have at least one collection operation.
Your first example works because you defined the path manually.

@Ener-Getick it's a bottleneck 馃幈

I understand to have a definition of item if you have a collection, but the opposite should be possible.

@Ener-Getick Exactly. I define the path on ItemOperations and it work.

Because it defines an operation ;)

Was this page helpful?
0 / 5 - 0 ratings