Docmaps-Project / docmaps

Extensible protocol for document history metadata exchange, to enable trustworthy, rapid, open science, by and for preprint science communities.
MIT License
15 stars 1 forks source link

Typescript generated types #7

Open ships opened 1 year ago

ships commented 1 year ago

Several Docmaps stakeholders are interested in structuring and destructuring docmaps programmatically for their own bespoke storage models. To enable these users, it would help to have a utility library in some typed language that allows modern developer productivity. The obvious choice is TypeScript.

This issue/thread can serve as a record of related tooling that might be useable or cannibalizeable for this purpose.

From my initial investigation, it seems that there are a few tools that generate Typescript from ontologies directly, though I haven't yet got any to work due to various limitations:

Additionally, we could start to interface with GraphQL and not just RDF stores, and convert to graphql and pipe into the highly maintained graphql-codegen . Since graphql is strictly smaller than the RDF spec in general, this would introduce some assumed limitations. However, given that true RDF is itself more general than any strong type system, maybe this is of no practical significance (ie., this pathway seems to generate deeply Maybeful types, which are indeed simple realities of an RDF graph which does not guarantee much in the way of completion).

ships commented 1 year ago

Another option is to specify the whole thing in SHACL constraints, given that docmap is exactly pwo:Workflow otherwise; there is some prior art for generating TS from SHACL: https://github.com/danielbeeke/shacl-meta-type . This would meant this issue is superceded by #8.