Closed bartoszm closed 1 year ago
I'm open to suggestions as long everything else works as well as before. I also rather stick to "works as designed" as to partial solutions. If you manage to find a solid holistic solution, I'm up for it 👍
I agree solving it partially is not a solution - will try to propose a holistic solution
Please take a look at the PR. I think I found a solution. There is also a question of whether encode / decode example name methods are needed any longer. Please let me know what you think.
Currently only examples under
application/json
are supported. However a proper json payload can be indicated by e.g.application/json;charset=utf-8
,application/vnd.some.model+json
. Both examples provided confirm to MIME grammar (https://en.wikipedia.org/wiki/Media_type).I thought simple improvement of a pattern could help. Like:
$..responses..content[?(@property.match(/[\/+]json/))].example
. However, it works only partially due to the how jsonpath-plus parser works internally - in short it uses;
as fragment separator. So I could identify all examples with improved json-path but then identification of elements would not work.Switching to json pointers could be a way forward.