-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
updated #761 for naming consistency #798
Conversation
@OAI/tdc please review |
Oh weird, I looked at your commit but I see the word |
type: array | ||
items: | ||
$ref: '#/definitions/Pet' | ||
representations: |
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.
text/html was in the (removed) produces
; please show how text/html (and other non-JSON responses) are coded with representations
@@ -466,8 +470,6 @@ Field Name | Type | Description | |||
<a name="operationDescription"></a>description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. | |||
<a name="operationExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. | |||
<a name="operationId"></a>operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. | |||
<a name="operationConsumes"></a>consumes | [`string`] | A list of media types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). |
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.
consumes
was removed from the operation, but representations
was not added as a fixed field to the Request Body Object. Should Request Body Object use a fixed field for representations
? The corresponding Request Body Examples lists a "representations"
item. (This will help solve some, but not all, deficiencies in OpenAPI for overloading operations.)
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'm fixing that.
@@ -466,8 +470,6 @@ Field Name | Type | Description | |||
<a name="operationDescription"></a>description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. | |||
<a name="operationExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. | |||
<a name="operationId"></a>operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. | |||
<a name="operationConsumes"></a>consumes | [`string`] | A list of media types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). | |||
<a name="operationProduces"></a>produces | [`string`] | A list of media types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). |
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.
produces
was removed from the operation, but representations
was not added as a fixed field to the Response Object. Should Response Object use a fixed field for representations
? The corresponding Response Object Examples lists a "representations"
item.
@@ -466,8 +470,6 @@ Field Name | Type | Description | |||
<a name="operationDescription"></a>description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation. | |||
<a name="operationExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. | |||
<a name="operationId"></a>operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. | |||
<a name="operationConsumes"></a>consumes | [`string`] | A list of media types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). | |||
<a name="operationProduces"></a>produces | [`string`] | A list of media types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Media Types](#mediaTypes). |
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'm confused by the use of *
for a patterned object for the schema object, when this used to be a fixed field schema
in 2.0. I don't know how to interpret *
here. Does this mean any key string is allowed and it maps to a schema? This should have an example. (As per my comment above - replace this patterned response with a representations
object?)
@@ -128,8 +128,6 @@ Field Name | Type | Description | |||
<a name="oasVersion"></a>openapi | `string` | **Required.** Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be `major`.`minor`.`patch`, where `patch` versions _must_ be compatible with the existing `major`.`minor` tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding `major`.`minor` (3.0.*). Patch versions will correspond to patches of this document. | |||
<a name="oasInfo"></a>info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed. | |||
<a name="oasHosts"></a>hosts | [Hosts Object](#hostsObject) | An array of Host objects which provide `scheme`, `host`, `port`, and `basePath` in an associative manner. | |||
<a name="oasConsumes"></a>consumes | [`string`] | A list of media types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Media Types](#mediaTypes). |
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.
For incompatible changes to OAS from 2.0 to 3.0, we need a guide (separate from the spec) on how to convert (or interpret). I.e. if consumes
/produces
are removed here, how does one transform a 2.0 document to 3.0 and preserve the same API definition? This also applies to removing consumes
/produces
on an operation. It's only slightly clearer there, since the representations
exist, but there are still some ambiguities: if produces lists more than one media type, which one is mapped to the 2xx response bodies, and what happens to the others? Example 2: how are the top level consumes
/produces
merged with the operation consumes
/produces
to yield the same effective representations
in request and response bodies?
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.
Yes, this is going to be a bit of a challenge. I think the only safe option is to project the mediatypes defined in produces and consumes down into the requestBody and responseObjects and create representation/content objects for each media-type. This could cause some unfortunate bloat in some specs. It is my understanding that operation level 'produces/consumes' overrides higher level declarations.
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.
@DavidBiesack the docs + migration information will come later. It doesn't make sense to do it right now until we're done with all structural changes.
"type": "array", | ||
"items": { | ||
"type": "string" | ||
"representations": { |
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.
The use of a JSON array schema with text/plain
is confusing. If it is an array of strings, it should be application/json. if it is a text (i.e. one user per line) then it is not an array. (Repeated in the YAML example.)
$ref: 'http://foo.bar/examples/user-example.xml' | ||
'*': | ||
schema: | ||
$ref: 'http://foo.bar/examples/user-example.whatever' | ||
``` | ||
|
||
A body parameter that is an array of string values: |
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.
This is no longer a "body parameter" but a "request body"
@@ -926,26 +934,34 @@ It can be used to cover undeclared responses. | |||
##### Patterned Fields | |||
Field Pattern | Type | Description | |||
---|:---:|--- | |||
<a name="responsesCode"></a>{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) <span>|</span> [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. | |||
<a name="responsesCode"></a>[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) <span>|</span> [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [OpenAPI Object's responses](#oasResponses) section. This field must quoted for compatibility between JSON and YAML (i.e. "200"), and may contain the uppercase character, `X` to designate a wildcard, such as `2XX` to represent all response codes between `[200-299]`. |
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 know the XX
wildcard was added previously, but are there (or should there be) constraints on the use of X
? I.e. certainly 2XX
and 4XX
make sense; but do 2X0
or XX0
make sense? Should we limit this to just 1XX, 2XX. 3XX, 4XX, 5XX
?
@@ -1649,19 +1702,15 @@ definitions: | |||
example: | |||
$ref: http://foo.bar#/examples/name-example | |||
|
|||
# in a request body, note the plural `examples` as the content-type is set by `consumes`: | |||
# in a request body, note the plural `examples` as the content-type is set 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.
Use Content-Type
not content-type
@@ -1649,19 +1702,15 @@ definitions: | |||
example: | |||
$ref: http://foo.bar#/examples/name-example | |||
|
|||
# in a request body, note the plural `examples` as the content-type is set by `consumes`: | |||
# in a request body, note the plural `examples` as the content-type is set 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.
I'm unclear on "is set to *
" as the example uses application/json
. Also, this does not set the Content-Type, it only matches it.
already merged -- is there another PR for some of the changes being worked on? (sorry if I'm not allowing time to actually create the PR!) Can FWIW, I prefer |
@DavidBiesack I merged both Tony's PR and my original PR in. We have the Callbacks PR to merge in and I need to create a PR for the changes to support URI Template stuff and because everything is in one file we keep causing ourselves merge conflicts. So, at this point it's probably best to raise issues with links to the main document and we'll tag them with the '3.0 needs documentation' tag. We can reuse responses, so I'm not sure there is a need for reusing content objects. But I'm open to being convinced otherwise. Initially I preferred representation, but once I realized that I could describe it as a content object that contains "Content Type" descriptions, and that ties directly to the HTTP header, it felt more natural. Most people are not familiar with the "representations" terminology. |
updated OAI#761 for naming consistency
This is a follow-up PR for #761, which fixes #721. The
representations
element has been added, along with support for multiple examples throughout theschema
object. In addition, the request body examples from #670 has been added to the PR.