← Back to team overview

u1db-discuss team mailing list archive

Documentation for CONSTRAINTS

 

Hey all,

There are currently two foo_CONSTRAINTS constants defined, but there
isn't really any documentation for them.

# constraints on database names (relevant for remote access, as regex)
DBNAME_CONSTRAINTS = r"[a-zA-Z0-9][a-zA-Z0-9.-]*"

# constraints on doc ids (as regex)
DOC_ID_CONSTRAINTS = r"[^/\\]+"


These needed to be documented a bit, at least for implementors of u1db
APIs in other languages. A bit of explanation in the comment, or in the
doc/ directory in a new file, would be very useful. These may also be
useful for app developers to know which characters their database names
and doc ids cannot have.

Furthermore, I think we need to define another CONSTRAINTS constant,
to prevent reserved characters being used in field names in the document
itself.