Open 0xMatt opened 4 years ago
@0xMatt After fixing this endpoint on my local copy
.
<route url="/V1/mma/me/vault/items" method="GET">
<service class="MMA\CustomApi\Model\PaymentTokenManagement" method="getListByCustomerId"/>
<resources>
<resource ref="self" />
</resources>
<data>
<parameter name="customerId" force="true">%customer_id%</parameter>
</data>
</route>
You are pointing to a methodrather than an interface.
There should be a method defined for this within MMA\CustomApi\Api\PaymentTokenManagementInterface
and it should be mapped in di.xml like the other methods have.
Also, you are using param docblocks of @param array
or @return array
, those actually need to be changed to mixed
, rather than array
. Fixing those allows Swagger UI to properly generate. I believe I had to fix 7 occurrences of this.
6.4.3.1. Strict typing is enforced for Service and Data interfaces located under MyCompany/MyModuleApi/Api. Only the following types are allowed:
- Scalar types: string (including Date and DateTime); int; float; boolean
- Data interfaces
- One-dimensional indexed arrays of scalars or data interfaces: for example string[], \MyCompany\MyModuleApi\Api\Data\SomeInterface[]. Hash maps (associative arrays) are not supported.
- Nullable scalars or data interfaces: for example string|null. Using just null is prohibited.
- void
So using mixed
isn't allowed and I remember it causes some issues on one of my projects. I don't remember exactly what it was. Also, I'm using array
more like a hack to avoid spending time on the creation of a proper interface. So feel free to use mixed
if it works for you, just be aware it can cause something.
You are pointing to a methodrather than an interface.
There should be a method defined for this within MMA\CustomApi\Api\PaymentTokenManagementInterface and it should be mapped in di.xml like the other methods have.
If you like to create PR for this I'll appreciate it
I'm no longer able to access swagger because of two errors
@return array
causes the APIgen to fail, changing@return mixed
fixes the issue