Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Validation for a JSON string inside of a request#959

Answeredbyp1c2u
jjimene1 asked this question inQ&A
Discussion options

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 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?

You must be logged in to vote
Answered by p1c2uFeb 21, 2025

Hi@jjimene1

it is possible to define specification for such case in OpenAPI 3.1.1 by usingcontentMediaType andcontentSchema. Although the library currently doesn't support it.

Replies: 1 comment 1 reply

Comment options

Hi@jjimene1

it is possible to define specification for such case in OpenAPI 3.1.1 by usingcontentMediaType andcontentSchema. Although the library currently doesn't support it.

You must be logged in to vote
1 reply
@jjimene1
Comment options

Ok thank you

Answer selected byjjimene1
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@jjimene1@p1c2u

[8]ページ先頭

©2009-2025 Movatter.jp