-
Notifications
You must be signed in to change notification settings - Fork 40
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
Consider typing interface{} fields? #20
Comments
Hey @abustany, I'll have time from next week onwards to look into this. Will follow up then with my thoughts 👍 |
Long overdue update on this: There were some changes in Notion API's version Long story short: This issue is still relevant, and indeed, I agree |
First of all, thanks for the work you're putting into this!
There are couple of places in the Go API where the type of a field is only known at runtime (eg.
Page.Properties
), so the field is typed asinterface{}
in Go. One approach that's used eg. by the protobuf runtime is to use an interface with a "dummy" method that uniquely identifies the implementors, which helps both IDEs/language servers to do autocompletion and the compiler to ensure that the code is correct.A simple example
let me know if you think this approach makes sense, and I can try to send a PR.
The text was updated successfully, but these errors were encountered: