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

moved reusable definitions under a single element #633

Merged
merged 5 commits into from
Apr 20, 2016
Merged

Conversation

fehguy
Copy link
Contributor

@fehguy fehguy commented Apr 8, 2016

Fixes #563

<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.
Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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.

@fehguy
Copy link
Contributor Author

fehguy commented Apr 8, 2016

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.~~
Copy link
Member

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
Copy link
Member

webron commented Apr 11, 2016

I find this PR to be partial and not cover what's suggested in #563 mostly because it doesn't cover the suggested global definitions.

@fehguy - since this is your PR, would you be okay with me pushing the additional changes to the branch so those can be reviewed as part of this PR?

@fehguy
Copy link
Contributor Author

fehguy commented Apr 11, 2016

@webron yep, please go for it.

@IvanGoncharov
Copy link
Contributor

@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 #/parameters/<name> instead of #/schemas/parameters/<name>.

@jharmn
Copy link
Contributor

jharmn commented Apr 13, 2016

RAML refers to this concept as traits (http://raml.org/developers/raml-200-tutorial#resource-types).
Also, the missing aspect in this PR is how to specify that a given path uses one of these schema (really misleading name). Defining the common/reusable aspects of a given path is only useful if we can apply it.

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.

@ePaul
Copy link
Contributor

ePaul commented Apr 13, 2016

@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).

@earth2marsh
Copy link
Member

I'm 👍 for centralizing, but finding the right name is the tricky bit. components or declarations as mentioned in the line comments seem reasonable.

@jharmn
Copy link
Contributor

jharmn commented Apr 14, 2016

@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.

@fehguy
Copy link
Contributor Author

fehguy commented Apr 15, 2016

leading names: declarations, components

@fehguy fehguy merged commit 082772c into OpenAPI.next Apr 20, 2016
<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.
Copy link
Contributor

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.

ePaul added a commit to ePaul/OpenAPI-Specification that referenced this pull request Apr 20, 2016
…rom OAI#633.

Also, rename it to "Interfaces Definitions Object".
@fehguy fehguy deleted the issue-563 branch October 20, 2016 17:12
handrews added a commit to handrews/OpenAPI-Specification that referenced this pull request Oct 11, 2024
moved reusable definitions under a single element

[Manually ported merge]

Co-authored-by: Tony Tam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants