-
Notifications
You must be signed in to change notification settings - Fork 13
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
GET requests without any body do not get rendered #55
Comments
I haven't worked with API Blueprint in a while, but if I remember correctly, The route parameters are written here: https://github.com/KittyHeaven/blue_bird/blob/master/lib/blue_bird/writer/blueprint.ex#L83 The generator module is responsible for turning the test data and api docs into the struct that is going to be written: https://github.com/KittyHeaven/blue_bird/blob/master/lib/blue_bird/generator.ex#L1 Were you able to reproduce the problem in a test? |
The route parameters render just fine. What I wanted to do is to show the test executed GET url in request/response section. Maybe best described via example. Given test: test "redirects resource request", %{conn: conn} do
conn =
conn
|> get(
Routes.resources_execute_path(
conn,
:execute,
"e868e42e-5714-4745-8d9a-607b8a346579",
%{"signature" => "82a21e67090a4e23984cf87d376719a5aa424a5fe093426194bc17ffd28c21e2"}
)
)
|> ConnLogger.save(title: "Redirect resource")
assert redirected_to(conn) =~ "http://dummy.url"
end It generates the following
So what's missing for me is the request from test. We have the response (with
I mean, we get all that with POST, where related payload is shown along with title. For GET requests it makes sense (at least to me) to show similar data. It would certainly help with multiple request/response test cases, where we'd have pairs of those in docs. Currently, only responses are shown and it's not always clear what the request was for particular response. Not even sure that this is doable via ApiBlueprint, hence the question 😄 |
If I understand the specification correctly, the I don't see a way to show the request uri including the query parameters or to describe the actual query parameters in the request. The uri parameters of a request are inherited from the parent section, cannot be overwritten and will only be rendered globally, not per request. The best thing we could do is to extract the query parameter values and add them to the global parameter section as example values (https://apiblueprint.org/documentation/specification.html#def-uriparameters-section), but we can only have one example value per parameter. |
I actually found several issues that are related to this (at least it seems like that to me!):
Last one is a merged PR even. But, if I read all that correctly, it looks like something is planned to support showing actual parameters with GET requests, but it's not there yet. So, it looks like there's nothing to be done for the moment. Thanks for your time! |
While documenting a GET request endpoint, e.g.
/resources/:uuid?signature=
with 1 path param (the:uuid
and one query param (the:signature
), I found that the request from related test isn't rendered in docs at all.I thought I found the problem in
lib/blue_bird/writer/blueprint.ex:141
:It creates attributes (
print_attributes
) from body params, which are already covered by&print_body_params/1
. So, I made it work with:That produces the related
Attributes
section in apib file:Unfortunately, rendering that as HTML doesn't output anything so only request title is actually rendered:
![image](https://user-images.githubusercontent.com/674883/70334519-e01c9100-1845-11ea-8873-ca3adb636740.png)
So couple of things would make sense to me here:
Not sure where the problem with rendering lies, hence no PR. If you can point me in the right direction, I'd be happy to contribute.
The text was updated successfully, but these errors were encountered: