Last active
January 16, 2022 19:32
-
-
Save daffl/7728140456ffdfa96ec858616a99a9c2 to your computer and use it in GitHub Desktop.
Feathers schema example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { schema, Infer } from '@feathersjs/schema' | |
export const userSchema = schema({ | |
$id: 'User', | |
type: 'object', | |
additionalProperties: false, | |
required: ['email', 'password'], | |
properties: { | |
id: { type: 'number' }, | |
email: { type: 'string' }, | |
password: { type: 'string' } | |
} | |
} as const) | |
export type User = Infer<typeof userSchema> | |
// type User = { | |
// id?: number; | |
// email: string; | |
// password: string; | |
// } |
@bitflower Correct. You can already use this with the current prerelease. More detailed documentation can be found at https://dove.docs.feathersjs.com/api/schema (which also shows how to do association and extension).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi David, so that's all that would be needed to get typescript interfaces out of json-schema?