POC: new rest-api structure + openapi/swagger #8073
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
POC for REST API redesign.
What about: tsoa?
For all objects that extend
AbstractCollection
,/rest/v0/${type}/
and/rest/v0/${type}/:id
are automatically registered. For collections that are not a XAPI collection, such as users, simply add thegetObjects
andgetObject
methods in the class.If the endpoint point to one object. (/rest/v0/users/1234/foo), the object will be automatically resolved (using
getObject
) and injected inres.locals.object
/rest/v0/dashboard
/rest/v0/hosts
/rest/v0/hosts/:id
/rest/v0/users
/rest/v0/users/:id
/rest/v0/vms
/rest/v0/vms/foo
/rest/v0/vms/:id
/rest/v0/vms/:id/name_label
endpoint rules:
/rest/<version>/ressources/<ressource_id>/sub-resource
/rest/<version>/ressources/<ressource_id>/actions/<action>
to create/delete/update a ressource (e.g. VM), always do a POST/DELETE/PATCH/ requestion on the ressource.
POST/DELETE/PATCH rest/v0/vms/
Checklist
Can all actions be performed in a group? (create multiple VMs, delete multiple VMs, start mutlitple VMs)
[-] use TS (and update the build or maybe put the REST API in @xen-orchestra?)
expose an action
handle sync an async actions
handle
AbstractCollection
routes with user permissionexpose openapi + swagger docs
Commit
Fixes #007
,See xoa-support#42
,See https://...
)Introduced by
Changelog
CHANGELOG.unreleased.md
PR
Review process
Notes: