Closed Bazze closed 7 years ago
Hi Sebastian!
Any luck with this? Currently, halacious runs during the onPreResponse
(post validation) phase of the hapi request lifecycle. Because it it modifies the response payload, I think a good case could be made for bumping it up to onPostHandler
, or at least making this a configuration setting. This should solve your problem.
Hey @bleupen! That sounds like a reasonable solution. I'm actually not very familiar with HAPI, but I'll be building most of my new services with it. I discovered this issue during my PoC-ing phase but since I haven't really started using HAPI yet I haven't digged any further into this. I will definitely do so though, probably in a month or two, if it has not yet been resolved by then.
Hello again @bleupen! I've started to work with HAPI now and coming back to this issue I realised that the response validation using the schema won't work at all, since the response validation sees the result
prop and not the _embedded
prop which I have in my schema (and what I want shown in my documentation).
I will start looking into the onPostHandler
and see what can be done there. If you have any further pointers that could help me save time I would love to hear them.
Closing this since the PR was merged a while ago 👍
Hey!
How do you handle ignored props when it comes to schema validation? Let's say I have the following hal config on my route:
And then a strict schema validation of the response like this:
So in my route handle I return an object with a
result
prop which is an array of objects that I embed using theprepare
function. I also ignoreresult
since I don't want it to be included. However, that gives me an error sinceresult
is not present in my schema validation....and I don't want
result
in my schema validation since that will cause it to show up in my swagger documentation.Has anyone else had this issue, and found a solution for it? (I do not want to use config settings like
stripUnknown
orallowUnknown
)