-
Notifications
You must be signed in to change notification settings - Fork 101
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
Deserialize HAL responses #30
Comments
The whole response is not deserialized, or do you mean the body? Can you post what you're getting back and what you're expecting to get back? |
Ah sorry, forgot to post a sample :( user=> (aws/invoke apigw-client {:op :GetRestApis})
{}
user=> (-> (aws/invoke apigw-client {:op :GetRestApis}) meta :http-response :body slurp json/read-json keys)
(:_links :_embedded) The HTTP response body in the metadata is a JSON string in HAL form. I guess it could be deserialized as the result of |
Just to clarify, the I expected user=> (s/describe (aws/response-spec-key apigw-client :GetRestApis))
(keys :opt-un [:cognitect.aws.apigateway.RestApis/position :cognitect.aws.apigateway.RestApis/items]) |
Thanks for that additional detail. I expect the same thing you do! FYI, you can also see the response structure like this: user=> (-> apigw-client aws/ops :GetRestApis :response)
{:position string,
:items
[:seq-of
{:endpointConfiguration {:types [:seq-of string]},
:description string,
:name string,
:warnings [:seq-of string],
:apiKeySource string,
:policy string,
:binaryMediaTypes [:seq-of string],
:id string,
:createdDate timestamp,
:version string,
:minimumCompressionSize integer}]} |
Had a quick look and found user> (-> apigw (aws/invoke {:op :GetRestApis}) meta (get-in [:http-response :headers "content-type"]))
"application/hal+json" |
Thanks @viesti - that's the same path I'm on. Just haven't had time to focus on this issue. |
No problem, just had an inspiration to look into this. Focus&time are Muses that I find hard to catch :) |
Happy muse-hunting! And thanks for checking in. This just might get some attention now ;) |
So I started to look into this and discovered (and fixed) an edge-case bug parsing json structures. This is fixed on master, and was necessary for me to move forward w/ the HAL issue. Will keep you posted. |
I've got a solution for this on the |
Nice! Good thing if this work generally improves the library :) |
Agreed! There are other services that also return HAL responses, so this is a bit more general than just apigw. |
True, I found that out myself only recently. |
Sorry for the duplicate! I can verify that the |
Thanks for the feedback @maxthoursie. I'm aiming to get a release out today. |
Fix merged to master. Release later today. |
Released in 0.8.198. |
* add release documentation to DEV.md
* add release documentation to DEV.md
* add release documentation to DEV.md
* add release documentation to DEV.md
* add release documentation to DEV.md
* add release documentation to DEV.md
Seems that API Gateway responses are not deserialized currently. I don't know the proper place/way to do deserialization, but here might be a pointer do get the embedded data of the HAL response: https://github.com/portkey-cloud/aws-clj-sdk/blob/master/src/portkey/aws.clj#L182-L197.
The text was updated successfully, but these errors were encountered: