Skip to content

Commit

Permalink
Merge pull request #94 from qwelias/upd-readme
Browse files Browse the repository at this point in the history
chore: document additionalProperties
  • Loading branch information
Coobaha authored Oct 30, 2023
2 parents 5a2364c + 02bbe28 commit 4eb1c50
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ addSchema(app, {
This library is using [typescript-json-schema](https://github.com/YousefED/typescript-json-schema) with custom
transforms for schema generation. All `@tjs` [annotations](https://github.com/YousefED/typescript-json-schema#annotations) can be used to fine-tune schema output

- `@type` can be used to specify end type after using `toJSON, toString` methods of objects like `ObjectID` from MogoDB
- `@type` can be used to specify end type after using `toJSON, toString` methods of objects like `ObjectID` from MongoDB

- since we use `typejescript-json-schema`: all known limitations are also inherited: - Records are not transformed correctly, use `{ [k: string]: string }` instead or hint with `@tjs`

- [additionalProperties](https://json-schema.org/understanding-json-schema/reference/object#additionalproperties) are set to `false` by default
- use `{ [k: string]: T }` index to explicitly define type for `additionalProperties`
- or add `/** @additionalProperties true */` annotation to allow anything
- for details see:
- [default fastify AJV options](https://fastify.dev/docs/latest/Reference/Validation-and-Serialization/#validator-compiler)
- [removeAddtitional in AJV](https://ajv.js.org/options.html#removeadditional)

0 comments on commit 4eb1c50

Please sign in to comment.