samchon / typia

Super-fast/easy runtime validators and serializers via transformation
https://typia.io/
MIT License
4.47k stars 154 forks source link

Add format for Mongodb ObjectId #661

Closed Th3Whit3Wolf closed 1 year ago

Th3Whit3Wolf commented 1 year ago

Feature Request: Validate ObjectIds

I would like to validate that a string is an ObjectId for mongodb. I have worked on it this over here but I get an issue when running the tests.

-------------------------------------------------------
  TRANSFORMATION TESTING
-------------------------------------------------------
{
  x: 8,
  y: 7,
  path: '$input.components.schemas.IMetadataTag.IFormat.properties.value.enum.length',
  typeofX: 'number',
  typeofY: 'number'
}
Error: Bug on typia.application("ajv"): failed to understand the UltimateUnion type.
samchon commented 1 year ago

If you run below command, then it may possible to build it.

However, the @format tag follows JSON schema definition, therefore I won't add any custom value in there.

Instead, you can use custom validation tags. Reading below documents, define your own type please.