Closed jonathanvila closed 3 years ago
@jonathanvila @m-brophy my two cents:
use queryParams
if they are optional values, use the body or pathParams
if the data is mandatory. Wdyt? sourceApplicationId and targetApplicationId
but I think what we should send to the backend is sourceAssessmentId and targetApplicationIds
using /POST /assessments/{sourceAssessmentId}/copy
and within the body of the request we should send the list of applicationIds we want to copy the assessment to. e.g:
POST /assessments/1/copy
{
applicationIdTarget: [1,2,3,4,5,6]
}
Of course for the current PR we should only copy assessments one by one but for the future, I think we should copy multiple assessments.
My opinion is that in POST/PUT operations we should be consistent with the rest of the endpoints and pass the data within the body and not through QueryParams. Technically nothing stops us from using QueryParams but I think we should have at least basic standards. The standard I propose is
use queryParams
if they are optional values,use the body or pathParams
if the data is mandatory. Wdyt?
I would say Queryparams can be used when are not part of an entity to be stored. Optional/Mandatory should be the criteria to use query params in my opinion. Few criterias :
Here there are few links that can support current approach : https://stackoverflow.com/questions/25385559/rest-api-best-practices-args-in-query-string-vs-in-request-body https://www.moesif.com/blog/technical/api-design/REST-API-Design-Best-Practices-for-Parameters-and-Query-String-Usage/
Obviously everything is opinionable in API design.
If from the UI point of view is easier using body content, we can modify it.
- For copying an assessment the current PR is using
sourceApplicationId and targetApplicationId
but I think what we should send to the backend issourceAssessmentId and targetApplicationIds
using/POST /assessments/{sourceAssessmentId}/copy
and within the body of the request we should send the list of applicationIds we want to copy the assessment to. e.g:POST /assessments/1/copy { applicationIdTarget: [1,2,3,4,5,6] }
Of course for the current PR we should only copy assessments one by one but for the future, I think we should copy multiple assessments.
The current scope for this PR is copying one by one. There's another Ticket to cover the bulk copy, that will need a little discussion to cover ( https://github.com/konveyor/tackle-pathfinder/issues/38 ) :
Appartfrom that the url you are proposing is copying an assessment NOT an application. From the UI perspective it is selecting an application not an assessment. The right way to do it would be : /application/1234/copy
But agains, this is totally opinable as the difference is very subtile.
My comments have all been addressed satisfactorily so when you are happy @carlosthe19916 can you merge this PR?
Issue : https://github.com/konveyor/tackle-pathfinder/issues/34
Features covered
Unit , Integration and End2End Tests cases covered
Pre steps Minikube:
Add this below
paths:
Test case with Minikube : Do the full API test
Pre steps non containerised local test:
Test case with local non containerised : Do the full API test
NOTE
Script Test step number involved in this feature : 13,14