-
-
Notifications
You must be signed in to change notification settings - Fork 242
Create getMetadata/getTitle/getDescription methods #1154
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
import { describe, expect, test } from 'vitest'; | ||
import * as v from '../../index.ts'; | ||
|
||
describe('getMetadata', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should have a test, which tests with nested object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what you mean by nested object, sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v.pipe(
v.object({
name: v.pipe(v.string(), v.title("The Name")0
}),
v.title("An object")
);
Or does this just get metadata of a single field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this just gets the metadata of the single schema (and any pipeline items), not any nested schemas like object entries - you'd need to do v.getMetadata(schema.pipe[0].entries.name)
146cfb7
to
82be15f
Compare
5c35af9
to
42cc1db
Compare
Loops through schema (including nested pipes) to shallowly merge metadata objects.