https://github.com/samchon/typia-mongoose-object-id
Test mongoose.ObjectID type
https://github.com/samchon/typia-mongoose-object-id
Last synced: over 1 year ago
JSON representation
Test mongoose.ObjectID type
- Host: GitHub
- URL: https://github.com/samchon/typia-mongoose-object-id
- Owner: samchon
- License: mit
- Created: 2024-01-15T10:31:44.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-16T01:08:45.000Z (over 2 years ago)
- Last Synced: 2025-02-25T04:34:20.856Z (over 1 year ago)
- Language: TypeScript
- Size: 102 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `mongoose.ObjectId` Type Demonstration
There had been repeated reports to `typia` that `typia` creates too long validation code for a `mongoose.ObjectId` type. I think users of `typia` just had expected that `mongoose.ObjectId` is just a `string` like type.
By the way, looking type definition of the `mongoose.ObjectId`, it is actually extremely complicated. This is a demonstration repo that how `mongoose.ObjectId` is extremely complicataed, so that recommends `typia` users not to validate the `moongoose` ODM schema instance.
```typescript
import { ObjectId } from "mongoose";
import { metadata } from "typia/lib/reflect";
import fs from "fs";
import typia from "typia";
fs.writeFileSync(
__dirname + "/../ObjectId.json",
JSON.stringify(
metadata<[ObjectId]>(),
null,
2,
),
'utf8',
);
typia.createIs();
```
- Metadata Schema: [ObjectId.json](./ObjectId.json)
- Type Checker: [ObjectId.check.js](./ObjectId.check.js)