question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Data representation of schema?

See original GitHub issue

Hey,

Given a Zod schema e.g.:

const a = z.object({
  foo: z.string(),
})

Is there a way to get a plain data representation of this?

I am trying to map a Zod schema to a GraphQL schema (specifically an input object type).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jasonkuhrtcommented, Jul 5, 2021

Thanks @colinhacks @scotttrinh for the feedback here. Its great to get a deep (and timely!) answer like this!

Points seem reasonable and make sense 👍

2reactions
jasonkuhrtcommented, Jul 2, 2021

@scotttrinh perhaps, I’ll check that out thanks!

IIUC .shape should give enough information to map the defined type/rules to another type system (of course within the bounds of what features overlap between Zod and the target system).

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are database schemas? 5 minute guide with examples
A database schema is an abstract design that represents the storage of your data in a database. It describes both the organization of...
Read more >
What is a Database Schema? - IBM
Schemas commonly use visual representations to communicate the architecture of the database, becoming the foundation for an organization's data ...
Read more >
Database schema - Wikipedia
In a relational database, the schema defines the tables, fields, relationships, views, indexes, packages, procedures, functions, queues, triggers, types, ...
Read more >
Chapter 8. Schema Representation
Each "significant" element of a database schema is represented in Theon as an individual file formatted as an XML-Schema document and referred to...
Read more >
Separate data schema from data representation
In DOP, the expected shape is expressed as a data schema that is kept separated from the data itself. The main benefit of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found