-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Examples documentation #893
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
Conversation
…nto issue-589-responses
…nto issue-589-responses
versions/3.0.md
Outdated
@@ -765,7 +765,7 @@ Field Name | Type | Description | |||
<a name="parameterAllowReserved"></a>allowReserved | `boolean` | Determines whether the parameter value should allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. | |||
<a name="parameterSchema"></a>schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. | |||
|
|||
For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. | |||
For more complex scenarios a `content` object can be used to define the media-type and schema of the parameter. Note that because the `content` object provides the appropriate serialization between examples and content serialization strategies, the `example` is not allowed in the simple `schema` scenario. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we are removing support for example
, examples
for the simple schema
case. @OAI/tdc make sure this makes sense!
The reasoning is that if examples are to be specified, there is no reason to avoid using the content
object which gives explicit example format information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ironically, we added "examples"
to JSON Schema for draft 06 (which I know you're not moving to anytime soon if ever, just thought I'd mention it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fehguy I'm not sure I agree with this. If format
is phonenumber
, or postalCode
you may want to include an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just kidding! Wanted to see if y'all were paying attention.
- name: Fluffy | ||
petType: Cat | ||
- name: Rover | ||
petType: Frog | ||
- {"name": "Rover", "petType": "Frog"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two examples are semantically equivalent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the json encoding inside the YAML (while correct) to be confusing; I don't think it is done elsewhere in the 3.0 spec.
|
||
In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the move to requestBody
, this didn't make sense anymore
@@ -1102,10 +1102,10 @@ application/json: | |||
schema: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inside a content object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capturing a TDC discussion comment "I would expect that any tooling worth its salt would throw this out if it failed to parse, but that it would try to parse it."
Does it make sense to allow a |
|
@whitlockjc - @darrelmiller brought the issue up during the call. While it makes sense, to avoid the extra layer we won't support it now. Maybe in future versions. Other than that, LGTM. |
|
versions/3.0.md
Outdated
<a name="contentTypeExamples"></a>examples | [Examples Array](#examplesArray) | Examples of the content type. | ||
<a name="contentTypeExample"></a>example | [Example Object](#exampleObject) | Example of the content type. | ||
<a name="contentTypeExamples"></a>examples | [Examples Array](#examplesArray) | Examples of the content type. Each example in the Examples Array must be in the correct format as specified in the _content_ type. The `examples` object is mutually exclusive to the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value will _override_ the example provided by the schema. | ||
<a name="contentTypeExample"></a>example | [Example Object](#exampleObject) | Example of the content type. The example object _must_ be in the correct format as specified in the _content_ type. The `example` object is mutually exclusive to the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value will _override_ the the example provided by the schema. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought on the call Ron suggested softening the MUST to a SHOULD. (in the above para, use MUST not must as per rfc)
In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. | ||
Tooling Specifications may choose to validate compatibility automatically, and reject the example value(s) if they are not compatible. | ||
In all cases, the payload is expected to be compatible with the type schema | ||
for the value that it is accompanying. Tooling implementations may choose to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... more weight to using SHOULD instead of MUSt above.
Examples documentation Merging per @OAI/tdc call
Documentation clarification for example, examples