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

Is this supposed to be a string or a JSON value? #3289

Closed
gregsdennis opened this issue May 30, 2023 · 6 comments
Closed

Is this supposed to be a string or a JSON value? #3289

gregsdennis opened this issue May 30, 2023 · 6 comments
Labels
clarification requests to clarify, but not change, part of the spec

Comments

@gregsdennis
Copy link

gregsdennis commented May 30, 2023

The YAML here yields a multiline string, but the other values use a JSON value. Was the string a mistake?

I note that in the corresponding .json file, it's also an encoded string, so it's probably correct. Why would this be?

@handrews
Copy link
Member

@jeremyfiel didn't this come up in one of our Slack discussions?

@jeremyfiel
Copy link

I believe we did have some discussion on it but can't find anything at the moment.

The value keyword expects a string and the only way to define an object schema is to encode it as a string. value doesn't allow schemas if that were the example representation

@gregsdennis
Copy link
Author

gregsdennis commented May 31, 2023

The value keyword expects a string and the only way to define an object schema is to encode it as a string.

This line is the exact same keyword, but this is parsed as an object, not a string. Why is there a difference?

(I suppose I should have mentioned this comparison at first.)

@darrelmiller
Copy link
Member

@jeremyfiel The value property is defined as Any.

To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.

There is nothing to stop someone representing a JSON or YAML as a string also. A consumer would have to do some reconciliation between the expected datatype of the parameter/content and the data type of the example value.

@gregsdennis
Copy link
Author

There is nothing to stop someone representing a JSON or YAML as a string also.

I would say that text implies that JSON/YAML should not be embedded in a string. I understand that it's not a hard requirement, but the implication seems quite apparent to me.

@handrews handrews added the clarification requests to clarify, but not change, part of the spec label Jan 27, 2024
@handrews
Copy link
Member

This is answered here:

and that issue is in the 3.0.4 milestone to be clarified. Closing this as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification requests to clarify, but not change, part of the spec
Projects
None yet
Development

No branches or pull requests

4 participants