getml / reflect-cpp

A C++20 library for fast serialization, deserialization and validation using reflection. Supports JSON, BSON, CBOR, flexbuffers, msgpack, TOML, XML, YAML / msgpack.org[C++20]
https://getml.github.io/reflect-cpp/
MIT License
901 stars 76 forks source link

More Regex-validators #24

Open liuzicheng1987 opened 8 months ago

liuzicheng1987 commented 8 months ago

If you are looking to a good first issue where you could easily add value to the library, you can always just add more Regex patterns:

https://github.com/getml/reflect-cpp/blob/main/include/rfl/patterns.hpp

One of the major goals of reflect-cpp is to make injection attacks harder by validating string patterns upfront using the Regex pattern validator (https://github.com/getml/reflect-cpp/blob/main/include/rfl/PatternValidator.hpp).

However, we don't have too many patterns yet.

If you can come up with good ideas for new patterns, write them in patterns.hpp, add some tests in https://github.com/getml/reflect-cpp/tree/main/tests/json and there is a very high likelihood that your PR will be merged.

liuzicheng1987 commented 8 months ago

If you are researching ideas for Regex patterns, one good source for inspiration is Pydantic:

https://docs.pydantic.dev/2.0/usage/types/extra_types/extra_types/