Title: Validation for a JSON string inside of a request · python-openapi/openapi-core · Discussion #959 · GitHub
Open Graph Title: Validation for a JSON string inside of a request · python-openapi/openapi-core · Discussion #959
X Title: Validation for a JSON string inside of a request · python-openapi/openapi-core · Discussion #959
Description: Validation for a JSON string inside of a request
Open Graph Description: Hi I have an API endpoint which expects a request with something like the following structure: { "rhs": ["{"object1": "value1"}, {"object2": "some-string"}"] } I would like to provide validation fo...
X Description: Hi I have an API endpoint which expects a request with something like the following structure: { "rhs": ["{"object1": "value1"}, {"object2": "some-...
Opengraph URL: https://github.com/python-openapi/openapi-core/discussions/959
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Validation for a JSON string inside of a request","text":"Hi I have an API endpoint which expects a request with something like the following structure:
\n{
\n\"rhs\": [\"{\"object1\": \"value1\"}, {\"object2\": \"some-string\"}\"]
\n}
\nI would like to provide validation for the outer structure but also for the string JSON within my JSON array. Right now when I try to validate, my string JSON is never deserialized into something I can validate against (throwing a body cast error), but if I specify it as a string the validator will not attempt to deserialize the string and assume everything is valid. Is there a way of having the validator attempt to deserialize the string through my OpenAPI schema or is this something that is not supported?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Hi @jjimene1
\nit is possible to define specification for such case in OpenAPI 3.1.1 by using contentMediaType and contentSchema. Although the library currently doesn't support it.
","upvoteCount":1,"url":"https://github.com/python-openapi/openapi-core/discussions/959#discussioncomment-12281535"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:bf4af542-452e-db30-c1b0-72505313a697 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | 84BA:307653:A18D5A7:D28275D:69774271 |
| html-safe-nonce | c3cd9b76f9b8483272c6e2f0a03056ae530e415bce057f20a2b32213a3babf9c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEJBOjMwNzY1MzpBMThENUE3OkQyODI3NUQ6Njk3NzQyNzEiLCJ2aXNpdG9yX2lkIjoiMjY5ODA0NTU2NDU5NDM3MzIzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3d7c71d21a1341479faf3d8c1cbc37610731b6d474bcdec213d3bb3037d552cb |
| hovercard-subject-tag | discussion:7999232 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-openapi/openapi-core/959/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/469f36744b9a6745a7e7fafad936d57fdf7c90ee50593cbd940a8bd2781d5200/python-openapi/openapi-core/discussions/959 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/469f36744b9a6745a7e7fafad936d57fdf7c90ee50593cbd940a8bd2781d5200/python-openapi/openapi-core/discussions/959 |
| og:image:alt | Hi I have an API endpoint which expects a request with something like the following structure: { "rhs": ["{"object1": "value1"}, {"object2": "some-string"}"] } I would like to provide validation fo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01d198479908d09a841b2febe8eb105a81af2af7d81830960fe0971e1f4adc09 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openapi/openapi-core git https://github.com/python-openapi/openapi-core.git |
| octolytics-dimension-user_id | 126442889 |
| octolytics-dimension-user_login | python-openapi |
| octolytics-dimension-repository_id | 104200746 |
| octolytics-dimension-repository_nwo | python-openapi/openapi-core |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 104200746 |
| octolytics-dimension-repository_network_root_nwo | python-openapi/openapi-core |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8b4769605623191b876ce084a47e46d8431b205a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width