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

Support example for proper json MIME types #190

Closed
bartoszm opened this issue Oct 5, 2023 · 3 comments · Fixed by #191
Closed

Support example for proper json MIME types #190

bartoszm opened this issue Oct 5, 2023 · 3 comments · Fixed by #191

Comments

@bartoszm
Copy link
Contributor

bartoszm commented Oct 5, 2023

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.

@codekie
Copy link
Owner

codekie commented Oct 5, 2023

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 👍

@bartoszm
Copy link
Contributor Author

bartoszm commented Oct 5, 2023

I agree solving it partially is not a solution - will try to propose a holistic solution

@bartoszm
Copy link
Contributor Author

bartoszm commented Oct 9, 2023

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.

codekie pushed a commit that referenced this issue Oct 9, 2023
* support for recognizing complex MIME definitions in OAS3 content type
fixes #190

* MR comment fixes vol 1.

* support of MIME for swagger v2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants