Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can edit property items object #91

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/modals/schema/EditSchemaProperty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ import { navigationStore, schemaStore } from '../../store/store.js'
type: array
</h5>

<div class="ASP-selectContainer">
<NcSelect v-bind="itemsTypeOptions"
v-model="properties.items.type" />
</div>

<!-- type array and sub type object only -->
<div v-if="properties.items.type === 'object'">
<NcInputField :disabled="loading"
type="string"
label="Schema reference of object ($ref)"
:value.sync="properties.items.$ref" />
</div>

<NcInputField :disabled="loading"
type="number"
label="Minimum number of items"
Expand Down Expand Up @@ -313,11 +326,21 @@ export default {
exclusiveMax: false,
minItems: 0,
maxItems: 0,
$ref: '',
items: {
$ref: '',
type: '',
},
},
typeOptions: {
inputLabel: 'Type*',
multiple: false,
options: ['string', 'number', 'integer', 'object', 'array', 'boolean', 'dictionary'],
options: ['string', 'number', 'integer', 'object', 'array', 'boolean', 'dictionary', 'file'],
},
itemsTypeOptions: {
inputLabel: 'Sub type',
multiple: false,
options: ['string', 'number', 'integer', 'object', 'boolean', 'dictionary', 'file'],
},
formatOptions: {
inputLabel: 'Format',
Expand Down Expand Up @@ -421,6 +444,10 @@ export default {
},
}

if (!newSchemaItem.properties[this.propertyTitle].items.$ref && !newSchemaItem[this.propertyTitle].items.type) {
delete newSchemaItem.properties[this.propertyTitle].items
}

if (!newSchemaItem?.id) {
this.success = false
this.error = 'Schema item could not be created, missing schema id'
Expand Down
Loading