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

Feature Request: Add handling for HAL responses #103

Closed
swright-eti opened this issue Dec 7, 2022 · 5 comments
Closed

Feature Request: Add handling for HAL responses #103

swright-eti opened this issue Dec 7, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@swright-eti
Copy link

Our REST APIs respond with either application/hal+json or application/problem+json. Would it be possible to add these response types as something that OpenBlocks understands? That way I dont have to have a transformer for all the responses.

Here is a doc from Spring about this: https://docs.spring.io/spring-hateoas/docs/current/reference/html/

@lmx1117
Copy link
Collaborator

lmx1117 commented Dec 8, 2022

Nice request🤩, so what do you expect to achieve, could you describe it more specifically, very appreciate that

@swright-eti
Copy link
Author

When OpenBlocks gets a response from an API and that response is one of application/hal+json or application/problem+json then the response body should be kept as JSON.

What happens now is that OpenBlocks treats the body of the response as an escaped JSON String. That means that for every response I need to have a Transformer to convert it back to JSON. If you look at the following image you can see that there is an array of devices on the path _embedded.devices. If I try to access that with {{get_device_list.data._embedded.devices}} it will fail with "undefined" because get_device_list.data does not contain JSON, it contains an escaped JSON string.

image

Adding the ability for OpenBlocks to handle HAL responses would extend or match the current behavior when the response is application/json.

@neon-balcony neon-balcony added the enhancement New feature or request label Dec 14, 2022
@neon-balcony
Copy link
Contributor

Hi @swright-eti ,

Very good point 😄 , we'll add this support in next release.

@neon-balcony
Copy link
Contributor

Hey @swright-eti , a hot fix image for this issue has been published, please update Openblocks and give us a try 😄

@swright-eti
Copy link
Author

I have tested this and it works. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants