zipmark/rspec_api_documentation

How to mask the response?

Opened this issue · 2 comments

Hello good afternoon

I am responsible for developing a web service of a legacy system. The system existed perhaps before starting rails. I need to mask some of the values returned by the request. Unfortunately the structure of the bank that works is large and complex to the point of not being able to define a strategy of replication and masking of the data. I thought about getting the return and treating him.

I did some tests trying to change response_body, client.last_request, client.send(:rack_test_session).last_request. I succeeded with

client.example.metadata[:requests][-1][:response_body] = my_data.to_json

However I know this is not the right way. Do you know of any way to solve this problem?

@SrMouraSilva, did you hear back from @jakehow on this? I'm also wondering if this is a good approach, or if there is a better one for amending the response for the docs.

My use case is after POSTing an image, the response contains the image url which keeps changing when re-generating the docs since it contains a fingerprint of the image asset, e.g. "image-d10f85e553702df607e3ee69.png".
I'd like to be able to hard-code that response attribute somehow in the spec.

@stwr667

Hello, I got no answer

I ended up changing technology and, consequently, no longer using this library