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

Discrepancy between Edition JSON schema and TypeScript type #378

Open
amyjko opened this issue May 27, 2024 · 0 comments
Open

Discrepancy between Edition JSON schema and TypeScript type #378

amyjko opened this issue May 27, 2024 · 0 comments
Assignees
Labels
debt Refactoring opportunities that improve maintainability or modifiability.

Comments

@amyjko
Copy link
Owner

amyjko commented May 27, 2024

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.
@amyjko amyjko added the debt Refactoring opportunities that improve maintainability or modifiability. label May 27, 2024
@amyjko amyjko self-assigned this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Refactoring opportunities that improve maintainability or modifiability.
Projects
Status: No status
Development

No branches or pull requests

1 participant