Skip to content
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

Test for requestBody in Operations which don't support a request body #616

Merged
merged 2 commits into from
May 31, 2024

Conversation

benjamin-confino
Copy link
Contributor

This resolves #591

This is built on top of #615 and will be marked as a draft until that is delivered.

There is no changes to SmallRye required to pass this test. I did not find any documentation mentioning the removed limitation. And ModelConstructionTest already covers RequestBody

@benjamin-confino benjamin-confino marked this pull request as draft May 15, 2024 10:59
@eclipse-microprofile-bot
Copy link
Contributor

Can one of the admins verify this patch?

Comment on lines 298 to 299
vr.body("paths.'/zepplins/{id}'.head.requestBody.$ref", equalTo("#/paths~1zepplins~1{id}/delete/requestBody"));
vr.body("paths.'/zepplins/{id}'.get.requestBody.$ref", equalTo("#/paths~1zepplins~1{id}/delete/requestBody"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vr.body("paths.'/zepplins/{id}'.head.requestBody.$ref", equalTo("#/paths~1zepplins~1{id}/delete/requestBody"));
vr.body("paths.'/zepplins/{id}'.get.requestBody.$ref", equalTo("#/paths~1zepplins~1{id}/delete/requestBody"));
vr.body("paths.'/zepplins/{id}'.head.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody"));
vr.body("paths.'/zepplins/{id}'.get.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody"));

@Azquelt
Copy link
Member

Azquelt commented May 15, 2024

@eclipse-microprofile-bot please test this

@benjamin-confino benjamin-confino marked this pull request as ready for review May 29, 2024 15:46
@benjamin-confino
Copy link
Contributor Author

With the prereqs in I have cleaned this up. All ready to go.

Comment on lines 55 to 57
public Response headZepplin(@RequestBody(ref = "#/paths/~1zepplins~1{id}/delete/requestBody") String string) {
return Response.ok().build();
}
Copy link
Member

@Azquelt Azquelt May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looks good, but I'm slightly concerned that Jakarta REST may not be required to support having an entity parameter (implying it can receive a request body) on a HEAD or GET request. Will take a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see anything in the Jakarta REST spec that says either way whether this is permitted. You're welcome to also have a look, but unless we're sure that this is required to be supported, I think we should test this in StaticDocumentTest or ModelReaderAppTest.

We only want to test that their MP OpenAPI implementation can document this kind of method, not that their Jakarta REST implementation allows it.

Copy link
Member

@Azquelt Azquelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above

Copy link
Member

@Azquelt Azquelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one thing needs fixed.

Comment on lines 52 to 54
public Response headZepplin(String string) {
return Response.ok().build();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file don't affect the tests any more, I guess you left them in because you've used them in other PRs that build on this one?

That's ok, but the @GET and @HEAD methods still have the string entity parameter and this should be removed.

@Azquelt Azquelt changed the title Test for @RequestBody in Operations Test for requestBody in Operations which don't support a request body May 31, 2024
@Azquelt Azquelt merged commit ce4a6a9 into eclipse:main May 31, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[OAS 3.1.0] Operation.requestBody now permitted for HTTP methods which don't allow a request body
3 participants