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

API Reference #32

Open
unsaved opened this issue Oct 21, 2023 · 1 comment
Open

API Reference #32

unsaved opened this issue Oct 21, 2023 · 1 comment

Comments

@unsaved
Copy link

unsaved commented Oct 21, 2023

README file last updated 13 months ago says API "Coming soon". 13 months is not soon. Is this project dead? The idea of a super-lightweight Zod is awesome, but not if I am going to be get completely stuck at some point because something won't work and there isn't a person in the world who can assist.

@richardscarrott
Copy link
Owner

richardscarrott commented Oct 21, 2023

Unfortunately I'm no longer using OK Computer regularly, largely because Zod gained so much popularity making it a hard sell.

Although I like a lot of OK Computer's design, the main oversight from me was the lack of parsing support which Zod does well.

// zod
const data: any = { name: 'Zod         ', foo: 'true' };
const parsedData = dataSchema.parse(data);
// { name: 'Zod', foo: true }: { name: string, foo: boolean }

The downside of Zod is, if you don't need to parse, you still have to assign and duplicate the object whereas in OK Computer you can just assert an already-in-scope variable.

// ok-computer
const data: any = { name: 'Ok Computer', foo: true }
assert(data, dataValidator);
// data: { name: string, foo: boolean }

Generally though I find parsing to be necessary.

This, combined with minimal popularity, means I haven't invested the time to fully document the API.

The README does give an overview of how OK Computer works and should be used. Additionally it's got quite high test coverage so the unit tests aren't a bad place to learn the API https://github.com/richardscarrott/ok-computer/blob/master/src/ok-computer.test.ts but I appreciate this isn't ideal.

If bugs with the existing API are reported, it's likely I'll fix them. However I doubt I'll be iterating much on the design unless I find a compelling reason to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants