https://github.com/octokit/plugin-enterprise-compatibility.js
Octokit plugin for improving GHE compatibility
https://github.com/octokit/plugin-enterprise-compatibility.js
hacktoberfest octokit-js plugin
Last synced: 2 months ago
JSON representation
Octokit plugin for improving GHE compatibility
- Host: GitHub
- URL: https://github.com/octokit/plugin-enterprise-compatibility.js
- Owner: octokit
- License: mit
- Created: 2019-01-09T20:03:12.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2025-10-28T21:45:00.000Z (2 months ago)
- Last Synced: 2025-10-28T23:27:43.213Z (2 months ago)
- Topics: hacktoberfest, octokit-js, plugin
- Language: TypeScript
- Homepage:
- Size: 3.73 MB
- Stars: 2
- Watchers: 5
- Forks: 7
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# plugin-enterprise-compatibility.js
> Octokit plugin for improving GHE compatibility
[](https://www.npmjs.com/package/@octokit/plugin-enterprise-compatibility)
[](https://github.com/octokit/plugin-enterprise-compatibility.js/actions?workflow=Test)
The GitHub API teams is continuously improving existing APIs to make the overall platform more consistent. For example, the [Add labels to an issue](https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue) expected the label names array to be sent directly in the request body root, as you can still see in the documentation for [GHE 2.15](https://developer.github.com/enterprise/2.15/v3/issues/labels/#input).
While consistency is great, changing like the above makes the current `octokit.issues.addLabels()` incompatible with GHE v2.15 and older. If you require compatibility with GHE versions, you can use the [Enterprise rest plugin](https://github.com/octokit/plugin-enterprise-rest.js), but that will remove new endpoint methods that are not available on Enterprise yet.
As a compromise, this plugin is reverting changes such as the one above to remain compatible with currently supported GitHub enterprise versions.
## Usage
Browsers
Load `@octokit/plugin-enterprise-compatibility` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [esm.sh](https://esm.sh)
```html
import { Octokit } from "https://esm.sh/@octokit/core";
import { enterpriseCompatibility } from "https://esm.sh/@octokit/plugin-enterprise-compatibility";
```
Node
Install with `npm install @octokit/core @octokit/plugin-enterprise-compatibility`. Optionally replace `@octokit/core` with a core-compatible module
```js
import { Octokit } from "@octokit/core";
import { enterpriseCompatibility } from "@octokit/plugin-enterprise-compatibility";
```
```js
const MyOctokit = Octokit.plugin(enterpriseCompatibility);
const octokit = new MyOctokit({
auth: "token123",
});
octokit.request("POST /repos/{owner}/{repo}/issues/{issue_number}/labels", {
owner,
repo,
number,
labels: ["foo", "bar"],
});
// sends ["foo", "bar"] instead of {"labels":["foo", "bar"]} as request body
```
## LICENSE
[MIT](LICENSE)