Skip to content

Refined guidelines for external file reuse #535

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

Merged
merged 5 commits into from
Jan 26, 2016
Merged

Refined guidelines for external file reuse #535

merged 5 commits into from
Jan 26, 2016

Conversation

jharmn
Copy link
Contributor

@jharmn jharmn commented Jan 8, 2016

Fairly big refactor of this section, to address #388

  • Renamed mentions of Swagger to OpenAPI Specification (I presumed we're doing this on any updates to docs now)
  • Added overall guidance for external files in dedicated section
    • Separated external files by URL from 'relative', i.e. local file references


Reuse schema definitions by creating a repository of definitions. This is done by simply hosting a file or set of files for commonly used definitions across a company or organization.

Refer to [External references](#external-references) for referencing strategies.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally left this section pretty empty, as #external-references has so many definition/schema examples.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON References can reference within the same document so I think the "creating a repository of definitions" is misleading. In fact, Swagger already uses this for parameters, responses, definitions, ...

I think the point of reuse is to suggest that reuse is enable through the use of JSON References. If we need to explain more about JSON References, do it of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<again, existing wording I tried to preserve>

You could say that parameters, responses, definitions are "repositories of definitions", which happen to reside in the same document (vs external files).

@webron
Copy link
Member

webron commented Jan 8, 2016

@jasonh-n-austin - let me know when the PR is ready to be merged.

@jharmn
Copy link
Contributor Author

jharmn commented Jan 13, 2016

@webron @whitlockjc @BigstickCarpet refactored based on PR/issue discussion.

  • Changed language to 'local' and 'remote'
  • Removed some excess samples for brevity
  • Removed references to JSON Pointer, made it clear that it's JSON Reference all the way down.
  • Other minor edits to capture feedback

* Parameters
* Responses
* Models (or Schema Objects in general)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit but for consistency, either italicize this or remove the italicization from the line below.

@whitlockjc
Copy link
Member

Please don't hate me. :) The biggest issue I had wasn't your fault and could likely be ignored for now and addressed later. The other pieces of feedback are all small.

@jharmn
Copy link
Contributor Author

jharmn commented Jan 14, 2016

@whitlockjc love it...keep it coming. Doc updates with no feedback are meaningless; updates with lots of feedback are always higher quality.

@jharmn
Copy link
Contributor Author

jharmn commented Jan 14, 2016

@whitlockjc commit'd fixes, with some rewording for brevity and consistency.

Gimmee some :shipit: ! 😺

The reuse technique is transparent between JSON or YAML and is lossless when converting between the two.
When authoring API design documents, common object definitions can be utilized to avoid duplication. For example, imagine multiple path definitions that each share a common path parameter, or a common response structure. The OpenAPI specification allows reuse of common object definitions through the use of "references".

A reference a construct in your API design document that indicates "the content for this portion of the document is defined elsewhere". To create a reference, at the location in your document where you want to reuse some other definition, create an object that has a `$ref` property whose value is a URI pointing to where the definition is (more on this in later sections).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"A reference a" should be "A reference is a".

@whitlockjc
Copy link
Member

Two minor nits, one of which is a formatting issue. After that, I don't see why this can't be merged. Good job.

@jharmn
Copy link
Contributor Author

jharmn commented Jan 14, 2016

OK fixed up content tweaks. @webron should be good for merge. Squirrel me!

@jharmn jharmn mentioned this pull request Jan 25, 2016
@@ -92,14 +147,14 @@ _Assuming file https://my.company.com/definitions/Model.json_
"format": "int64"
},
"tag": {
"description": "a complex, shared property. Note the absolute reference",
"description": "A complex, shared property. Note the absolute reference",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was in the original example as well, but the description is obviously ignored and does not override the value inside the reference (as previously mentioned in the doc). I get this is used here for documentation to the readers, but it may also send the wrong message. I'll merge as-is, but we may consider removing it after all.

@webron
Copy link
Member

webron commented Jan 26, 2016

Thanks all for the great work on this, and apologies for the delay in merging. I think we're good to go.

webron added a commit that referenced this pull request Jan 26, 2016
Refined guidelines for external file reuse
@webron webron merged commit 9289c71 into OAI:master Jan 26, 2016
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.

5 participants