-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use DTO's for POST/PUT request bodies. #2321
Conversation
ff295c5
to
949848b
Compare
The first candidates would be the The other individual functions:
|
What is the new way of working with them? Is one the superset of the other or do they overlap?
I would say so? It would make it much easier for people to create an IOI judge or if we plan to change the judgedaemon to another implementation?
Can we change the CLICS spec or is CLICS correct here?
Agree
That makes sense right, don't repeat that request if we can't do anything with it. |
Nope they have different skillsets... Just use the JMS stuff like we used to and for request params the Symfony one will be used. Hopefully in the future the Symfony one is more nature and we can replace the JMS one.
Well the API itself won't change right, only the parsing logic. But I agree, it might be better.
I don't think we can easily change the CLICS spec. This is just a drawback of the serializer: there is no easy way to distinguish between
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
public function addAction(Request $request, ImportExportService $importExport): Response | ||
{ | ||
public function addAction( | ||
#[MapRequestPayload(validationFailedStatusCode: Response::HTTP_BAD_REQUEST)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to add this everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default is a 422. If you can live with that we can drop the validationFailedStatusCode
part, but then we need to update the tests (since we sometimes return a 400 and sometimes a 422) or we always need to return a 422.
} | ||
|
||
public function provideAddInvalidData(): Generator | ||
{ | ||
yield ['demo', [], "Argument 'text' is mandatory."]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't display any text anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you submit nothing there is an empty 400 (or 422 if we change the above thing) since Symfony doesn't know what to do. As soon as you supply any field (even an unknown one) we do display an error. It's a bit annoying but IMHO not a very big deal.
629650c
to
c3cc539
Compare
Co-authored-by: MCJ Vasseur <[email protected]>
c3cc539
to
9c8731a
Compare
Some notes:
null
. A bit ugly.After this we should discuss what more to change to DTO's @vmcj, you have gone through most code.