notionapi icon indicating copy to clipboard operation
notionapi copied to clipboard

Generating structs based on the typescript types from the official JS sdk

Open jhchabran opened this issue 4 years ago • 0 comments

After going back and forth on #9, it feels like making sure the API reference is properly implemented is a quite meticulous task that is quite error prone and may introduce vicious bugs that will be hard to track down.

The official JS SDK has all the API types properly defined in Typescript, which could be used to generate those structs: https://github.com/makenotion/notion-sdk-js/blob/main/src/api-types.ts

An example on how to achieve that can be found in gopls, which uses that approach to handle the structs that deals with the Language Server Protocol: https://github.com/golang/tools/tree/master/internal/lsp/protocol/typescript

I may give it a try in the upcoming days, I'll post here if I do!

jhchabran avatar Aug 01 '21 11:08 jhchabran