Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kael-shipman/swagger-ui-plugins
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: combined
Choose a base ref
...
head repository: benepass/swagger-ui-plugins
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: combined
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 6 commits
  • 12 files changed
  • 1 contributor

Commits on Jul 29, 2024

  1. [ENG-IDK] bp docs

    AGarrow committed Jul 29, 2024
    Copy the full SHA
    6e4a2c4 View commit details

Commits on Jul 30, 2024

  1. Copy the full SHA
    068b28a View commit details

Commits on Jul 31, 2024

  1. Copy the full SHA
    8075151 View commit details
  2. rename library

    AGarrow committed Jul 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4d150f2 View commit details
  3. readme

    AGarrow committed Jul 31, 2024
    Copy the full SHA
    95c29b1 View commit details
  4. Merge pull request #2 from benepass/alexi/eng-idk/bp-docs

    [ENG-16517] nested tag documentation
    AGarrow authored Jul 31, 2024
    Copy the full SHA
    d5f70ad View commit details
1 change: 1 addition & 0 deletions packages/hierarchical-tags/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
build
*.sw[op]
bun.lockb
3 changes: 2 additions & 1 deletion packages/hierarchical-tags/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@kael-shipman:registry=https://npm.pkg.github.com/kael-shipman
@benepass:registry=https://npm.pkg.github.com/benepass/
//npm.pkg.github.com/:_authToken=$BENEPASS_GITHUB_PACKAGE_TOKEN
54 changes: 23 additions & 31 deletions packages/hierarchical-tags/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
Swagger UI 'Hierarchical Tags' Plugin
==================================================================
# Swagger UI 'Hierarchical Tags' Plugin

This plugin produces a layout with endpoints grouped into a hierarhical list based on tags with (optional) special
delimiter characters to denote hierarchy. Delimiter characters are `|` and `:` by default, but may be configured using
the `hierarchicalTagSeparator` config option.

(ref discussions [here](https://github.com/swagger-api/swagger-ui/issues/5969) and [here](https://github.com/OAI/OpenAPI-Specification/issues/1367))


## Installation and Setup

The easiest way to use this plugin for front-end projects is to link to it from your html via unpkg.
Below is a full working html document that you can use as a starting point:

```html
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<!-- Load Swagger UI -->
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>

<!-- Load the HierarchicalTags Plugin -->
<script src="https://unpkg.com/swagger-ui-plugin-hierarchical-tags"></script>

<!-- Load styles -->
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css" />
<link
rel="stylesheet"
type="text/css"
href="https://unpkg.com/swagger-ui-dist/swagger-ui.css"
/>

<script>
window.onload = function() {
window.onload = function () {
SwaggerUIBundle({
url: "https://unpkg.com/swagger-ui-plugin-hierarchical-tags/example/pet-store.json",
dom_id: "#swagger",
plugins: [
HierarchicalTagsPlugin
],
hierarchicalTagSeparator: /[:|]/
})
}
plugins: [HierarchicalTagsPlugin],
hierarchicalTagSeparator: /[:|]/,
});
};
</script>
</head>
<body>
<div id="swagger"></div>
</body>
</html>
</html>
```

### Installing Locally Via NPM
@@ -90,27 +90,22 @@ npm install --save @kael-shipman/swagger-ui-plugin-hierarchical-tags
To use a local install, require it in your client-side application and apply it to your swagger instance:

```js
const HierarchicalTagsPlugin = require('@kael-shipman/swagger-ui-plugin-hierarchical-tags');
const HierarchicalTagsPlugin = require("@kael-shipman/swagger-ui-plugin-hierarchical-tags");

SwaggerUI({
// your options here...
plugins: [
HierarchicalTagsPlugin
],
hierarchicalTagSeparator: /[:|]/
})
plugins: [HierarchicalTagsPlugin],
hierarchicalTagSeparator: /[:|]/,
});
```


## Hierarchical Tags Plugin Options

* `hierarchicalTagSeparator` - (Optional, defaults to `/[|:]/`) The separator character(s) on which to split
- `hierarchicalTagSeparator` - (Optional, defaults to `/[|:]/`) The separator character(s) on which to split
hierarchical tags. Can be any string or regexp.


## Development


### Live-Testing Development

1. Clone this repo, cd into `packages/hierarchical-tags` and `npm install`
@@ -120,16 +115,13 @@ From here, you should be able to go to `http://localhost:8080` in your browser a
hierarchical tags active. You can mess around with the `example/pet-store.json` and `example/index.html` files to try
different inputs.

When you change the source code, just run `npm run build` to rebuild the plugin file in the `example` folder and reload
When you change the source code, just run `bun run build` to rebuild the plugin file in the `example` folder and reload
the page.


### Publishing

(This is more of a note-to-self.)
create a classic personal access token on github with the `packages:write` scope.

To publish the github package, simply bump the version and run `npm publish`.
save that token as an env var called `BENEPASS_GITHUB_PACKAGE_TOKEN`

To publish to unpkg (via npmjs.com), just remove the `@kael-shipman` prefix from the package name
and then run `npm publish` again. You should revert this change when you've successfully published
the package to npm.
To publish the github package, simply bump the version and run `npm publish`.
Loading