Hydra API Documentation doesn't reflect all possible HTTP Methods
System Information
- PartKeepr Version: Up to latest
- Reproducible on the demo system: Yes
Prolog
Hi, this weekend I have developed a Parser for the Hydra API JSON Documentation, which merges the informations found in there with some parsed informations of the latest git source code of Partkeepr (reading Packages in /src/Partkeepr/ Controller/Entity). Aim of the parser is to gather enough metadata for generating a swagger.json / OpenAPI Document, which would make implementation of client projects easier for me.
Current state is that a valid swagger.json pops out of the parser - but in the Hydra API JSON Doc, not all possible HTTP Methods are provided.
TL;DR The Problem
My example is that the POST for /api/parts is clearly missing:
The Hydra Doc shows only "GET/PUT/DELETE/PUT/PUT/PUT".

Attempts in a sackgasse
There would be a possibility to read the possible POST from src\PartKeepr\PartBundle\Resources\config\actions.xml, but i think the notation of <service id="partkeepr.part.post" isn't generic enough for referring to http methods each time, cause other services have names like partkeepr.parts.collection_get, which i can't directly programmatically say which method they interpret.
My need would be, that the JSON document provided at /api/apidoc contains all valid HTTPMethods.
Have a nice time, thanks for the great product so far! 😸
@xyzaxyz thnx for your input on this.
Can you share your parser so we have a tool to inspect the api docs a little better?
Hi @dromer, sure, I should probably have been sharing this earlier on.
The code may not be the prettiest.
hydratoswagger.zip
There is commented-out code in lib/converters.js (L79-112), I am currently not sure if that is critical or if it can be removed.
Cool, thnx!
I could not update my previous comment with an additional attachment, but I guess this could be also interesting for some:
If someone is only interested in the (partially incomplete) swagger.json for Partkeepr:
partkeepr-swagger.json.zip