symfony-cmf / resource-rest-bundle

REST API for Puli Resources provided through the CmfResourceBundle
https://cmf.symfony.com
11 stars 16 forks source link

Provide schema defintion based on ALPS spec #29

Open ElectricMaxxx opened 8 years ago

ElectricMaxxx commented 8 years ago

To give customers of the api the right tool to get information abaout a resource we should provide profile information based on ALPS spec

dbu commented 8 years ago

we have good experiences with swagger, which is relatively lightweight. i did not find what ALPS would look like but it seems to be on a more abstract level? if the two are similar, we can maybe generate both from the same data.

i am not sure to what extent we can actually do this. afaik the main challenge is to describe the data models. we could generate model description from phpdoc + doctrine mappings. but a user might decide to let some mapped properties be handled by doctrine listeners or something rather than editable by the client.

ElectricMaxxx commented 8 years ago

Generating that stuff out of the doctrine metadata is a good idea, Would work for both. I really love swagger.io too, but do we have a chance to dynamically create documentations? Ah, yea that is the point swagger and RAML a kind of documentations, but ALPS is a little bit different, it describes the semantics what you can do on resources, and what you can do on its properties. You can find nice slides here. @olivergierke provided both in his example app (alps and schema) but i think that is automaticially created by a spring rest component and their swagger annotations. He described it in some slides. But Maybe wo should push that feature into HateoasBundle or FosRestBundle to get a generic solution, that we can implement in here?

dbu commented 8 years ago

i am unsure how much we can automate semantic things. but if its possible then FOSRestBundle or the HateoasBundle sound like the best place for that. or maybe even a stand alone library/bundle if none exists yet (though i don't intend to start yet another project).

for swagger, there is https://github.com/zircote/swagger-php which would really profit from a symfony integration.