-
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
moved reusable definitions under a single element #633
Conversation
<a name="oasPaths"></a>paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API. | ||
<a name="oasDefinitions"></a>definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations. | ||
<a name="oasSchemas"></a>schemas | [Schemas Object](#schemasObject) | An element to hold various schemas for the specification. |
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.
global
library
definitions (swap)?
@OAI/tdc please provide any other naming suggestions
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.
As mentioned in #563, I would prefer definitions/schemas to schemas/definitions, though I can understand resistance to reusing a property name from a previous version with a different name.
For machine readers, the distinction should be clear from the version property, but humans might be confused. On the other hand, schemas
on the top level might lead to confusion with JSON schema (i.e. that everything in it is a JSON schema document), which only applies to the model definitions, while actually everything in here is a definition of some kind, so definitions
actually captures it better.
global
might be read to indicate that the contents (specifically parameters) are valid for every operation.
library
doesn't cause confusion (I think), but also doesn't really say what it is.
Unfortunately I have no other ideas here.
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 naming suggestions:
components
fragments
chunks
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.
While I like definitions
because that's just what they are, components
work well because we commonly use the term Reusable Components
as parts that can be referenced from different locations in the spec.
Another option would be 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.
I agree with @webron that definitions
is a good word, but then again, it has some baggage from 2.0. Either declarations
or components
works for me.
This feature allows us to have top-level attributes which propagate down to all operations, and a separate section for (definitions) in a single block. Also ensure that it's clarified what the override process is for the global parameters. |
<a name="oasParameters"></a>parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters that can be used across operations. This property *does not* define global parameters for all operations. | ||
<a name="oasResponses"></a>responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold responses that can be used across operations. This property *does not* define global responses for all operations. | ||
<a name="oasSecurityDefinitions"></a>securityDefinitions | [Security Definitions Object](#securityDefinitionsObject) | Security scheme definitions that can be used across the specification. | ||
<a name="oasSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. | ||
<a name="oasSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition.~~ |
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 strikethrough should end at securityDefinitions
. security
is global to the spec and is meant to stay as-is. Also, strikethrough doesn't work well in tables. Look for my summarizing comment on this PR.
@webron yep, please go for it. |
@fehguy @webron Please consider #647 as an alternative. It solve the same problem with global parameters but also allow same functionality for a group of resources. As nice bonus it's backward compatible and JSON pointers stay nice and short |
RAML refers to this concept as I think this is what @ePaul is trying to accomplish in his competing PR. It seems like the right answer is somewhere between the two. |
@jasonh-n-austin Maybe I'm misunderstanding you, but I think your comment does not really apply to this PR – this is just collecting all the reusable definitions (of parameters, model schemas, ...) into one object instead of having them directly in the root object. This is not competing with #650 (#650 is just depending on this one for implementation details). |
I'm 👍 for centralizing, but finding the right name is the tricky bit. |
@ePaul OK that's what I want to make sure we have it clearly stated, thanks. I guess we'll have to make another pass at making these usable a la traits. |
leading names: |
<a name="responsesDefinitionsObject"></a> | Responses Definitions Object | Reusable responses objects. | ||
<a name="parametersDefinitionsObject"></a> | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here. | ||
<a name="responseHeadersDefinitionsObject"></a> | [Response Headers Definitions Object](#responseHeadersDefinitionsObject) | Response headers to reuse across the specification. | ||
<a name="securityDefinitionsObject"></a> | [Security Definitions Object](#securityDefinitionsObject) | Security definitions to reuse across the specification. |
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.
Here is still something missing – in the first column we need the actual field names of this components object (like definitions
, responses
, parameters
, ...), and different name
attributes (they currently are the same as for the objects linked in the second column, which will break stuff). I guess something like componentsDefinitions
, componentsResponses
, ... would do for the names.
I only noted this after the merge (trying to rebase my #650), sorry.
…rom OAI#633. Also, rename it to "Interfaces Definitions Object".
moved reusable definitions under a single element [Manually ported merge] Co-authored-by: Tony Tam <[email protected]>
Fixes #563