bookish
bookish copied to clipboard
Discrepancy between Edition JSON schema and TypeScript type
The JSON schema we use to check the validity of Edition
objects is missing types that have been added to the TypeScript schema (e.g., active, uids, chapteruids). This has generally been okay, since we've only been using the TypeScript schema on bookish.press books. But since we developed import.js
, this divergence is starting to translate into defects. See in import.js
, for example, how we have to define a bunch of fields on the edition that aren't there locally, to make it conform to the platform's expectations.
The clean solution to this is to:
- Define two TypeScript schemas, one for local books, and a superset for platform books.
- Generate JSON schemas automatically from the TypeScript schemas.
- Define a way of converting from local to platform, filling in the missing fields
- Use all of these in
import.js
to check validity more carefully.