-
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
Make paths object optional #1781
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0ba7343
Make paths object optional
MikeRalphson b39dbdf
Merge branch 'v3.1.0-dev' into paths-optional
webron efaf094
Adding reusable Path Item Objects
webron 4836cce
Adopt DM's suggested change to OpenAPI doc definition
MikeRalphson bfcaa37
Cleanup use of specification and definition where we mean document
MikeRalphson 4754b94
multipartite>composite, define ACL
MikeRalphson 9073629
Add ' | Reference Object' to callbacks/webhooks
MikeRalphson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There's something that has never been quite clear to me: Suppose I have several files (or resources) that collectively describe a single API. One top-level file that defines the API overall, including its path items, and others that are collections of schemas, responses, and other reusable components. Is each of these physical files an OpenAPI document? Or do the files collectively comprise a single document?
It looks like the word "document" means both things:
"A self-contained or multipartite resource which defines or describes an API..." sounds like it refers to a single logical API definition, possibly composed from multiple resources.
"...resource which defines or describes an API or elements of an API" sounds like it refers to any resource that includes any OpenAPI component.
@earth2marsh , IIRC, you first suggested the word "document" in a discussion thread that was debating "definition" vs. "description" vs. something else. At that time, I understood "document" to mean a physical file or addressable resource containing a valid OpenAPI Object. The document may define an actual API, having one or more Path Item Objects, and it may have any number of internal or external component references. Or it may be a library of components, with an empty Paths Object. But either way, it is a single resource.
If that's the definition, then shouldn't we have a different term to describe the composite, logical API description? Could we call that thing an "OpenAPI description" or "OpenAPI definition"? (Either is OK with me.)
OTOH, if document means the logical, self-contained or composite API definition, then should we use a different term for the individual resource(s)? Could each of those be an "OpenAPI resource" or "OpenAPI file" maybe?
As it stands, the word "document" seems to refer to both things, and this PR doesn't change that. The ambiguity can make it harder to talk about OpenAPI projects, and can lead to miscommunication.
Also, a small thing: I don't see the word "multipartite" very often. Interesting word. But would "composite" be a better choice for our target audience?
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 framing of
A document (or set of documents)
suggests to me that a document is like a resource. Whether an API is described using one or many documents, it can always be expressed as a fully-resolved single filed. This would be true in an overlay future, too. I have found that in common parlance, people (myself included) refer to that thing as "a spec". Myself, I just consider thatSpecification
is referring to the class andspec
is the instance, but I can understand why some folks are less comfortable with that.Since my defeat in the great "definition" vs "description" wars, I have arrived at a better framing of why I preferred the latter term. When thinking about the phrase, "The menu is not the meal," it struck me that a spec is like the menu in how it describes what can be expected for a dish. Who has not been surprised to discover, either pleasantly or not, that the dish delivered to their table was unexpectedly different from what was in their mind when they ordered it?
FWIW, I prefer the "A document (or set of documents) that" phrasing, as it uses plainer language. "Multipartite" is an interesting new word I learned today, but I find it too abstruse for something that is already carrying a large cognitive load. :)
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.
"Multipartite" is a perfectly cromulent word 😄 Perhaps it's more common in British English. I'll go with "composite" for now as 'a document is a document or set of documents' is a bit of an awkward / recursive 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.
@earth2marsh , thanks for the clarification and additional detail on "document." It sounds like it matches my second candidate meaning:
So, could we use language that avoids the "document" self-reference, and makes it clear that an OAS document is a single physical resource, not a set of resources?
It is also my understanding that an OpenAPI document must have an OpenAPI Object as its top-level element, and that OpenAPI Object is the thing that must contain one or more of these fields:
I assume that since we're talking about "fields" and their specific property names (paths, components, webhooks) as opposed to object types, a resource having only a Paths Object, Components Object, or Webhooks Object without the containing OpenAPI Object would not be considered an OAS document. Please correct me if I misunderstood.
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.
@tedepstein I didn't want to repeat what was defined as REQUIRED elsewhere in the document, repetition can open the door to inconsistencies.
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.
@MikeRalphson , I think you're referring to this sentence:
That wasn't my suggestion; it was introduced in commit 4836cce.
My only suggested changes were:
If you want to remove the sentence about required fields altogether, then my last point is moot.