Skip to content

Commit 9617cef

Browse files
committed
Workaround for issue vuejs/vue-cli#6225
1 parent bb8a490 commit 9617cef

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Fixed
10+
- `JsonSchema` and `ObjectTree` show all details when used as Web Component [vue-cli#6225](https://github.com/vuejs/vue-cli/issues/6225)
11+
12+
913
## [2.0.0-beta.1] - 2020-01-20
1014

1115
This release contains a large number of changes. It lists only the major changes that may need users to adapt their code. Bug fixes or minor improvements are not listed in detail.

components/JsonSchema.vue

+9-7
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
<template v-if="hasReturns">
1818
<Description v-if="schema.returns.description" :description="schema.returns.description" :processUrl="processUrl" />
1919
<div class="json-schema-container" v-if="schema.returns.schema">
20-
<JsonSchema :schema="schema.returns.schema" />
20+
<openeo-json-schema :schema="schema.returns.schema" />
2121
</div>
2222
</template>
2323
<p v-else>No constraints defined.</p>
2424
</div>
2525
</div>
2626
<div v-else-if="showRow('object')" class="schemaObjectElement">
2727
<div class="inline-schema-attrs">
28-
<JsonSchema v-if="filteredObjectSchema !== null" :schema="filteredObjectSchema" :nestingLevel="nestingLevel+1" />
28+
<openeo-json-schema v-if="filteredObjectSchema !== null" :schema="filteredObjectSchema" :nestingLevel="nestingLevel+1" />
2929
<table class="object-properties">
3030
<tr>
3131
<th colspan="2" class="object-prop-heading">Object Properties:</th>
@@ -36,7 +36,7 @@
3636
<strong class="required" v-if="schema.required && schema.required.indexOf(key) !== -1" title="required">*</strong>
3737
</td>
3838
<td class="value">
39-
<JsonSchema :schema="val" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
39+
<openeo-json-schema :schema="val" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
4040
</td>
4141
</tr>
4242
</table>
@@ -59,7 +59,7 @@
5959
</tr>
6060
<tr>
6161
<td colspan="2" class="schema-container data-types-container">
62-
<JsonSchema v-for="(v, k) in compositeTypes" :key="k" :schema="v" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
62+
<openeo-json-schema v-for="(v, k) in compositeTypes" :key="k" :schema="v" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
6363
</td>
6464
</tr>
6565
</template>
@@ -70,7 +70,7 @@
7070
<td class="value">
7171
<span v-if="key == 'type'" class="data-type">{{ formatType() }}</span>
7272
<div v-else-if="key == 'allOf' && Array.isArray(val)" class="schema-container">
73-
<JsonSchema v-for="(v, k) in val" :key="k" :schema="v" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
73+
<openeo-json-schema v-for="(v, k) in val" :key="k" :schema="v" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
7474
</div>
7575
<span v-else-if="key != 'default' && key != 'examples' && val === true" title="true">✓ Yes</span>
7676
<span v-else-if="key != 'default' && key != 'examples' && val === false" title="false">✕ No</span>
@@ -85,7 +85,7 @@
8585
<em v-else-if="key == 'default' && val === ''">Empty string</em>
8686
<code v-else-if="key == 'default' && (typeof val === 'object' || typeof val === 'boolean')">{{ JSON.stringify(val) }}</code>
8787
<code v-else-if="key == 'pattern'">{{ val }}</code>
88-
<JsonSchema v-else-if="typeof val === 'object'" :schema="val" :initShown="nestingLevel < 3" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
88+
<openeo-json-schema v-else-if="typeof val === 'object'" :schema="val" :initShown="nestingLevel < 3" :nestingLevel="nestingLevel+1" :processUrl="processUrl" />
8989
<span v-else>{{ val }}</span>
9090
</td>
9191
</template>
@@ -124,7 +124,9 @@ export default Utils.enableHtmlProps({
124124
};
125125
},
126126
components: {
127-
Description: () => import('./Description.vue')
127+
Description: () => import('./Description.vue'),
128+
// Workaround for issue https://github.com/vuejs/vue-cli/issues/6225
129+
'openeo-json-schema': () => import('./JsonSchema.vue')
128130
},
129131
beforeCreate() {
130132
// See https://vuejs.org/v2/guide/components-edge-cases.html#Circular-References-Between-Components

components/ObjectTree.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<template v-else-if="Array.isArray(data)">
55
<ol>
66
<li v-for="i in indicesShown" :key="i">
7-
<ObjectTree v-if="isStructured(data[i])" :data="data[i]"></ObjectTree>
7+
<openeo-object-tree v-if="isStructured(data[i])" :data="data[i]"></openeo-object-tree>
88
<a v-else-if="isUrl(data[i])" :href="data[i]" target="_blank">{{ data[i] }}</a>
99
<em v-else-if="format(data[i])">{{ format(data[i]) }}</em>
1010
<template v-else>{{ data[i] }}</template>
@@ -15,7 +15,7 @@
1515
<ul v-else-if="typeof data === 'object'">
1616
<li v-for="(value, key) in data" :key="key">
1717
<template><strong>{{ prettifyKey(key) }}</strong>: </template>
18-
<ObjectTree v-if="isStructured(value)" :data="value"></ObjectTree>
18+
<openeo-object-tree v-if="isStructured(value)" :data="value"></openeo-object-tree>
1919
<a v-else-if="isUrl(value)" :href="value" target="_blank">{{ value }}</a>
2020
<em v-else-if="format(value)">{{ format(value) }}</em>
2121
<template v-else>{{ value }}</template>
@@ -29,7 +29,11 @@
2929
import Utils from '../utils.js';
3030
3131
export default Utils.enableHtmlProps({
32-
name: 'ObjectTree',
32+
name: 'ObjectTree',
33+
components: {
34+
// Workaround for issue https://github.com/vuejs/vue-cli/issues/6225
35+
'openeo-object-tree': () => import('./ObjectTree.vue')
36+
},
3337
props: {
3438
data: {
3539
type: [Object, Array],

utils.js

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Utils extends CommonUtils {
1919
}
2020
else if (types.includes('Boolean')) {
2121
// Functions for default are not executed for Boolean, so remove the type
22+
// PR to solve this issue: https://github.com/vuejs/vue-web-component-wrapper/pull/58
2223
delete vue.props[key].type;
2324
}
2425
let defaultValue = vue.props[key].default;

0 commit comments

Comments
 (0)