Skip to content

Commit 523038b

Browse files
authored
Merge pull request #667 from citation-file-format/656-error-msg
adding check for minimum CFF in Preview
2 parents d2a1264 + f155752 commit 523038b

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/components/Preview.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@
3636
wrap="hard"
3737
/>
3838
<div class="validation-msg">
39-
<p v-bind:class="isValidCFF ? '' : 'invalid'">
39+
<p
40+
v-if="doesNotHaveRequiredFields"
41+
class="invalid"
42+
>
43+
Your CITATION.cff does not have the minimum fields
44+
</p>
45+
<p
46+
v-else
47+
v-bind:class="isValidCFF ? '' : 'invalid'"
48+
>
4049
Your CITATION.cff is {{ isValidCFF ? "valid" : "not valid" }}
4150
</p>
4251
</div>
@@ -66,6 +75,9 @@ export default defineComponent({
6675
return {
6776
cffstr,
6877
copyToClipboard,
78+
doesNotHaveRequiredFields: computed(() => errors.value
79+
.map((v) => v.instancePath)
80+
.some((i) => i.includes('title') || i.includes('authors') || i.includes('message'))),
6981
isValidCFF: computed(() => errors.value.length === 0),
7082
showTooltip
7183
}

0 commit comments

Comments
 (0)