You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started writing TypeScript .d.ts declarations for Fontra classes, to help with development and create a more declarative interface, and found I was duplicating information already present in the classes.json file. When trying to turn this classes.json into declarations programmatically, I stumbled across QuickType. QuickType is a Javascript library which transforms type information (in JSON, JSON Schema or Postman format) into class definitions, including serializers and deserializers, for multiple languages; it can emit JavaScript, TypeScript, Python data classes, etc.
This creates two possibilities:
The less disruptive approach: If the existing fontra.core.classes module were to emit a JSON Schema file like so:
then instead of classes.js, we could generate the relevant Javascript classes automatically with QuickType. The fromObject definitions would also go away, as the QuickType code would include a deserializer.
The more disruptive approach: If the JSON Schema document was hand-written, then both the Javascript and the Python class definitions could be generated automatically by QuickType.
I'm happy to work on either of these if thought to be a good idea.
The text was updated successfully, but these errors were encountered:
I started writing TypeScript
.d.ts
declarations for Fontra classes, to help with development and create a more declarative interface, and found I was duplicating information already present in theclasses.json
file. When trying to turn thisclasses.json
into declarations programmatically, I stumbled across QuickType. QuickType is a Javascript library which transforms type information (in JSON, JSON Schema or Postman format) into class definitions, including serializers and deserializers, for multiple languages; it can emit JavaScript, TypeScript, Python data classes, etc.This creates two possibilities:
fontra.core.classes
module were to emit a JSON Schema file like so:then instead of
classes.js
, we could generate the relevant Javascript classes automatically with QuickType. ThefromObject
definitions would also go away, as the QuickType code would include a deserializer.I'm happy to work on either of these if thought to be a good idea.
The text was updated successfully, but these errors were encountered: