We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1398af0 + eedc005 commit 3b83885Copy full SHA for 3b83885
README.md
@@ -77,12 +77,14 @@ Coming from `express-jsonschema`? Read the [migration notes](docs/migrating-from
77
### Schemas in TypeScript
78
79
If you're writing JSON schemas in TypeScript, you'll need to use the
80
-`AllowedSchema` type e.g.
+`AllowedSchema` type and this can be combined with [ajv's recommended `JSONSchemaType` type](https://ajv.js.org/guide/typescript.html) e.g.
81
82
```typescript
83
+import { JSONSchemaType } from "ajv";
84
import { AllowedSchema } from "express-json-validator-middleware";
85
-const addressSchema: AllowedSchema = {
86
+type Address = { street: string; };
87
+const addressSchema: AllowedSchema & JSONSchemaType<Address> = {
88
type: "object",
89
required: ["street"],
90
properties: {
0 commit comments