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

feat: support metadata in pipe #655

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

xcfox
Copy link
Contributor

@xcfox xcfox commented Jun 14, 2024

Implements #373, support metadata in pipe and pipeAsync.

In this implementation, metadata is used as previously discussed

// With the new `pipe` function
const UserSchema = pipe(
  object({
    id: pipe(string(), uuid(), primaryKey()),
    name: pipe(string(), maxLength(32), unique()),
    bio: pipe(string(), description('Text ...')),
  }),
  table('users')
);

Metadata can add extra properties on the schema:

const schema = pipe(
  object({
      key: string(),
  }),
  withDescription('some Description')
)
console.log(schema.description) // 'some Description'

Currently, I've added two metadata:

  • withDescription: add description for schema
  • asParser: add a parse method for schema

@fabian-hiller
Copy link
Owner

Sorry for not getting back to you in #373, but I am still working on other areas of the library as a result of our rewrite, and the metadata feature is not something I want to rush. It is important to me to make the right decisions. As soon as I find the time, I will answer you in the issue.

@fabian-hiller fabian-hiller self-assigned this Jun 15, 2024
@fabian-hiller fabian-hiller added the enhancement New feature or request label Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants