@josephinumresearch/swagger-ui-map-plugin 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/example.html +38 -0
- package/package.json +5 -5
- package/src/index.html +6 -6
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# SwaggerUI Map Plugin
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Josephinum-Research/swagger-ui-map-plugin/actions/workflows/npm-publish.yml)
|
|
4
|
+
[](https://github.com/Josephinum-Research/swagger-ui-map-plugin/releases)
|
|
5
|
+
[](https://josephinum-research.github.io/swagger-ui-map-plugin/example.html)
|
|
6
|
+
|
|
2
7
|
SwaggerUI plugin to show GeoJson responses on a map
|
|
3
8
|
|
|
4
9
|
<img src="./example.png" alt="example" width="300">
|
|
@@ -8,7 +13,7 @@ SwaggerUI plugin to show GeoJson responses on a map
|
|
|
8
13
|
|
|
9
14
|
1. Add `Openlayers` and this plugin to your swaggerui index file
|
|
10
15
|
```html
|
|
11
|
-
<script src="https://cdn.jsdelivr.net/npm/ol@v10.
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/ol@v10.7.0/dist/ol.js" crossorigin></script>
|
|
12
17
|
<script src="https://cdn.jsdelivr.net/npm/@josephinumresearch/swagger-ui-map-plugin/dist/swagger-ui-map-plugin.js" crossorigin></script>
|
|
13
18
|
```
|
|
14
19
|
2. Register `SwaggerUiMapPlugin()`
|
|
@@ -26,6 +31,4 @@ SwaggerUIBundle({
|
|
|
26
31
|
|
|
27
32
|
## Dev
|
|
28
33
|
|
|
29
|
-
Run `npm install` and
|
|
30
|
-
|
|
31
|
-
For deployment, build the `dist/swagger-ui-map-plugin.js` with `npm run build` and run `npm publish --access public` to publish.
|
|
34
|
+
Run `npm install` and `npm run dev`.
|
package/example.html
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="description" content="SwaggerUI" />
|
|
7
|
+
<title>SwaggerUI</title>
|
|
8
|
+
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.32.0/swagger-ui.css" />
|
|
9
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.7.0/ol.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="swagger-ui"></div>
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/ol@v10.7.0/dist/ol.js" crossorigin></script>
|
|
14
|
+
<script src="https://unpkg.com/swagger-ui-dist@5.32.0/swagger-ui-bundle.js" crossorigin></script>
|
|
15
|
+
<script src="https://cdn.jsdelivr.net/npm/@josephinumresearch/swagger-ui-map-plugin/dist/swagger-ui-map-plugin.js" crossorigin></script>
|
|
16
|
+
<script>
|
|
17
|
+
window.onload = () => {
|
|
18
|
+
window.ui = SwaggerUIBundle({
|
|
19
|
+
url: 'https://processing.terrazo.at/openapi.json',
|
|
20
|
+
filter: 'Demo',
|
|
21
|
+
plugins: [
|
|
22
|
+
SwaggerUiMapPlugin({
|
|
23
|
+
renderer: {
|
|
24
|
+
geojson: {
|
|
25
|
+
activationFnc: props => ['application/geo+json', 'application/json'].includes(props.contentType),
|
|
26
|
+
config: {
|
|
27
|
+
defaultStrokeWidth: '2'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
],
|
|
33
|
+
dom_id: '#swagger-ui',
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
</body>
|
|
38
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@josephinumresearch/swagger-ui-map-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "webpack --mode=production",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"@babel/preset-react": "^7.24.7",
|
|
27
27
|
"babel-loader": "^9.2.1",
|
|
28
28
|
"html-webpack-plugin": "^5.6.0",
|
|
29
|
-
"ol": "^10.
|
|
30
|
-
"react": "
|
|
31
|
-
"webpack": "
|
|
29
|
+
"ol": "^10.7.0",
|
|
30
|
+
"react": ">=16.8.0 <20",
|
|
31
|
+
"webpack": "5.104.1",
|
|
32
32
|
"webpack-cli": "^5.1.4",
|
|
33
|
-
"webpack-dev-server": "
|
|
33
|
+
"webpack-dev-server": "5.2.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"lodash.merge": "^4.6.2"
|
package/src/index.html
CHANGED
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<meta name="description" content="SwaggerUI" />
|
|
7
7
|
<title>SwaggerUI</title>
|
|
8
|
-
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.
|
|
9
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.
|
|
8
|
+
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.32.0/swagger-ui.css" />
|
|
9
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.7.0/ol.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="swagger-ui"></div>
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/ol@v10.
|
|
14
|
-
<script src="https://unpkg.com/swagger-ui-dist@5.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/ol@v10.7.0/dist/ol.js" crossorigin></script>
|
|
14
|
+
<script src="https://unpkg.com/swagger-ui-dist@5.32.0/swagger-ui-bundle.js" crossorigin></script>
|
|
15
15
|
<script>
|
|
16
16
|
window.onload = () => {
|
|
17
17
|
window.ui = SwaggerUIBundle({
|
|
18
|
-
url: 'https://
|
|
18
|
+
url: 'https://processing.terrazo.at/openapi.json',
|
|
19
19
|
plugins: [
|
|
20
20
|
SwaggerUiMapPlugin({
|
|
21
21
|
renderer: {
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
};
|
|
34
34
|
</script>
|
|
35
35
|
</body>
|
|
36
|
-
</html>
|
|
36
|
+
</html>
|