Skip to content

Commit ea7b2fb

Browse files
authored
Merge pull request #589 from DocHubTeam/v3.13.4
v3.13.4
2 parents ce1a412 + 96292f9 commit ea7b2fb

File tree

12 files changed

+84
-25
lines changed

12 files changed

+84
-25
lines changed

distrib/idea/IDEAPlugin-4.1.4.zip

-31.8 MB
Binary file not shown.
Binary file not shown.

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/documentation/docs/manual/docs/examples/example.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ paths:
1919
content:
2020
application/json:
2121
schema:
22-
type: array
23-
items:
24-
type: string
22+
$ref: "#/definitions/ResponseSchema"
23+
definitions:
24+
ResponseSchema:
25+
$ref: "./ext-schema.yaml"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type: array
2+
items:
3+
type: string

src/frontend/components/Docs/DocMixin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,13 @@ export default {
163163
result?.startsWith('res://') && (result = requests.expandResourceURI(result));
164164
return result;
165165
},
166+
contentBasePath() {
167+
return uriTool.getBaseURIOfPath(`${this.path}/${this.isTemplate ? 'template' : 'source'}`) || this.baseURI;
168+
},
166169
url() {
167-
const contentBasePath = uriTool.getBaseURIOfPath(`${this.path}/${this.isTemplate ? 'template' : 'source'}`) || this.baseURI;
168170
let uri = this.profile.template || this.profile.source;
169171
uri?.startsWith('res://') && (uri = requests.expandResourceURI(uri));
170-
let result = this.profile ? uriTool.makeURIByBaseURI(uri, contentBasePath).toString() : null;
172+
let result = this.profile ? uriTool.makeURIByBaseURI(uri, this.contentBasePath).toString() : null;
171173
if (!result) return null;
172174
result += result.indexOf('?') > 0 ? '&' : '?';
173175
result += `id=${this.id}&path=${encodeURI(this.path)}`;

src/frontend/components/Docs/DocSwagger.vue

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
import DocMixin from './DocMixin';
4040
import { getAsyncApiContext } from '@front/helpers/misc';
4141
import env from '@front/helpers/env';
42+
import requests from '@front/helpers/requests';
4243
44+
const ROOT_PATH_DEEP = 16;
45+
const ROOT_PATH = 'http://null/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$root';
46+
4347
export default {
4448
name: 'DocSwagger',
4549
mixins: [DocMixin],
@@ -66,16 +70,40 @@
6670
getAsyncApiContext.call(this, true);
6771
},
6872
73+
async proxy(url) {
74+
let target = new URL(String(url));
75+
const base = new URL(ROOT_PATH);
76+
if (target.hostname !== base.hostname) return url;
77+
let deep = target.pathname.split('$/').length - 1;
78+
target = '../'.repeat(ROOT_PATH_DEEP - deep) + target.pathname.slice(deep * 2 + 1);
79+
const response = await requests.request(target, this.url);
80+
const data = new Blob([ response.data ], {type: response.headers?.['content-type'] || 'plain/text'});
81+
return URL.createObjectURL(data);
82+
},
83+
84+
async requestInterceptor(request) {
85+
if (request.url === ROOT_PATH) {
86+
const rootData = new Blob([typeof this.data === 'string' ? this.data : JSON.stringify(this.data) ], {type: 'application/json'});
87+
return {
88+
...request,
89+
url: URL.createObjectURL(rootData)
90+
};
91+
} else return {
92+
...request,
93+
url: await this.proxy(request.url)
94+
};
95+
},
6996
swaggerRender() {
7097
if (this.url) {
7198
SwaggerUI({
7299
dom_id: `#${this.dom_id}`,
73-
spec: this.data,
100+
url: ROOT_PATH,
74101
deepLinking: !env.isPlugin(),
75102
docExpansion: this.isPrintVersion ? 'full' : 'list',
76103
presets: [
77104
SwaggerUI.presets.apis
78-
]
105+
],
106+
requestInterceptor: this.requestInterceptor
79107
});
80108
}
81109
}

src/frontend/components/Docs/DocTable.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<v-data-table
1313
v-bind:mobile-breakpoint="0"
1414
v-bind:headers="headers"
15-
v-bind:items="source.dataset || []"
15+
v-bind:items="items"
1616
v-bind:search="search"
1717
v-bind:items-per-page="itemsPerPage"
1818
v-bind:multi-sort="true"
@@ -108,6 +108,10 @@
108108
headers() {
109109
return this.profile?.headers || [];
110110
},
111+
items() {
112+
const result = this.source.dataset || [];
113+
return Array.isArray(result) ? result : [result];
114+
},
111115
perPage() {
112116
return (this.profile || {})['per-page'];
113117
},

src/frontend/manifest/manager.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ manifestParser.cache = cache;
4040

4141
manifestParser.reloadManifest = async function(payload) {
4242
await manifestParser.startLoad();
43+
// eslint-disable-next-line no-console
44+
console.info('Metamodel URI is', env.uriMetamodel);
4345
if (payload) {
4446
await (
4547
async function parserImport(next = 0) {
@@ -75,22 +77,29 @@ manifestParser.reloadManifest = async function(payload) {
7577
}
7678

7779
// Если корневой манифест указан загружаем
78-
rootManifest
79-
&& await manifestParser.import(manifestParser.cache.makeURIByBaseURI(rootManifest, requests.getSourceRoot()));
80+
if (rootManifest) {
81+
const rootURI = manifestParser.cache.makeURIByBaseURI(rootManifest, requests.getSourceRoot());
82+
// eslint-disable-next-line no-console
83+
console.info('Root manifest URI is', rootURI);
84+
await manifestParser.import(rootURI);
85+
// eslint-disable-next-line no-console
86+
} else console.warn('Root manifest is not defined');
8087
} else {
8188
/* Подключаем базовую метамодель */
8289
await manifestParser.import(manifestParser.cache.makeURIByBaseURI(env.uriMetamodel, requests.getSourceRoot()));
8390

84-
await manifestParser.import(
85-
manifestParser.cache.makeURIByBaseURI(env.rootManifest, requests.getSourceRoot()));
91+
const rootURI = manifestParser.cache.makeURIByBaseURI(env.rootManifest, requests.getSourceRoot());
92+
console.info('Root manifest URI is', rootURI);
93+
await manifestParser.import(rootURI);
8694

8795
manifestParser.loaded = {};
8896
}
8997
}
98+
9099
await manifestParser.checkAwaitedPackages();
91100
manifestParser.checkLoaded();
92101

93-
manifestParser.stopLoad();
102+
setTimeout(() => manifestParser.stopLoad(), 100);
94103
};
95104

96105
export default manifestParser;

src/global/bitbucket/driver.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export default function(config) {
3939
};
4040

4141
this.makeFileURI = (projectID, repositoryId, source, branch) => {
42+
if (!config.bitbucket_server) throw new Error('Not defined Bitbucket server!');
43+
if (!projectID || !repositoryId || !source || !branch) throw new Error(`incorrect Bitbucket URI to ${projectID}:${repositoryId}:${branch}@${source}!`);
4244
const result = new URL(
4345
`rest/api/1.0/projects/${projectID}/repos/${repositoryId}/raw/`
4446
+ encodeURIComponent(source).split('%2F').join('/')

0 commit comments

Comments
 (0)