Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@privy-io/public-api

Package Overview
Dependencies
Maintainers
8
Versions
548
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@privy-io/public-api

  • 0.0.0
  • npm
  • Socket score

Version published
Weekly downloads
29K
increased by13.51%
Maintainers
8
Weekly downloads
 
Created
Source

Privy schemas

Naming conventions

The zod README is full of inconsistencies - in one place it will use camelCase and in another PascalCase for the same thing. Because of this, chaos reigns, so we have our own guide.

1. PascalCase everything

Whether it's z.string or z.object or anywhere in between, name it with PascalCase. Easier than creating heuristics.

2. Suffix with Input if used for parsing req.body

If the schema is used to parse req.body in an API handler, suffix with Input (ie CreateUserInput). This is relevant as you should not inherently rely on these types except in the context of the API handler, as the API handler signature may change.

3. Suffix with Type if exporting a type

When feeding into a TypeScript type, always suffix with Type (ie CreateUserInputType). The Zod docs imply that you can somehow overload a zod type name with a TypeScript type, but this does not work in practice.

For creating types, you simply use z.infer:

type ImportAppleAccountInputType = z.infer<typeof ImportAppleAccountInput>;

File conventions

Just group logically and we'll revisit as it becomes untenable 🤷

Inline schemas

If a schema is only used in a single API handler, it's discretionary whether to pull the schema out. We'll have to do this anyway if/when we do OpenAPI specs, so do what feels cleanest. If they are used anywhere outside of it, move it to lib/schemas.

FAQs

Package last updated on 25 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc