Open Tazoeur opened 5 years ago
I had no plans for that, but it can be considered as a good starting point for something bigger. I suppose there will be demand in matching those routes with controllers->methods in oas schemas
to let users create their own more customisable routes.
Do u mean this kind of declarations?:
/users:
(meta-resource-method): on a resource
get:
(meta-resource-method): on a method
responses:
200:
body:
type: User[]
(meta-data): on a body
Yes
I got another exemple below.
Those are not "simple" CRUD url, but since there is a definition for those, we could imagine that the routes could already be written.
Of course the provided OpenAPI
file may contain more information within the facets
options (e.g. the controller where the route will be managed, considering that the displayName could be the action)
I must say that I did not think this through, but IMHO it's a must have feature for a OpenAPI
parser & code gen package.
/paper/validate/{id}:
uriParameters:
id:
type: integer
post:
displayName: "validate_paper"
description: "Change the status of a \"waiting\" paper to \"validated\""
responses:
200:
body:
application/json:
type: "boolean"
example: true
400:
body:
application/json:
type: "Error"
example:
value: "{\n \"status\": 400,\n \"Message\": \"Generic error\"\n}"
strict: false
/paper/reject/{id}:
uriParameters:
id:
type: integer
post:
displayName: "reject_paper"
description: "Change the status of a \"waiting\" paper to \"rejected\""
responses:
200:
body:
application/json:
type: "boolean"
example: true
400:
body:
application/json:
type: "Error"
example:
value: "{\n \"status\": 400,\n \"Message\": \"Generic error\"\n}"
strict: false
It is ok for standard routes CRUD, but how do we define routes for bulks
and relationships
? There must be some flag for those.
If I understood well, your plugin will take the data structure of the OAS and create entities, routes, migration, FormRequests, controlers ...
but the OAS file itself might contain some route definition. Are those routes managed ? Do you plan to do something with it ?