# Array type checking for attribute values

**URL:** <https://discuss.prosemirror.net/t/array-type-checking-for-attribute-values/1308>\
**Category:** Uncategorized\
**Created:** [April 28, 2018, 6:10pm UTC](https://discuss.prosemirror.net/t/array-type-checking-for-attribute-values/1308 "2018-04-28T18:10:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanneswilm](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/johanneswilm/32/19_2.png) [@johanneswilm](https://discuss.prosemirror.net/u/johanneswilm)\
**Post date:** [April 28, 2018, 6:10pm UTC](https://discuss.prosemirror.net/t/array-type-checking-for-attribute-values/1308/1 "2018-04-28T18:10:29Z")

</div>

Hey, for citation we use a special node that has one attribute called “references” which is an array of objects, each of which need to have a “before”, “page” and “source” key. We need to do it like that because every citation contains several references and their rendering depends a bit on one-another.

For reading and writing to the dom, we simply turn the array into a string using `JSON.stringify()` and when parsing the DOM we now will do some checking instead of just doing `JSON.parse()`, but while looking at that I was wondering if we should not also do some checks like that when reading the document from the database, just to make sure it’s all as it should be.

Has anyone tried doing something like this by extending on how the schema definition in ProseMirror works?
