Comments (3)
I would like to close this issue (no privilege for me) because we do not support the type that is not JSON Schema.
Type.RegExp
return type: 'RegExp'
instead of type: 'string'
.
https://github.com/sinclairzx81/typebox/blob/master/src/type/regexp/regexp.ts#L55
cc @sinclairzx81 It there any reason to use RegExp
instead of string
?
from env-schema.
@climba03003 Hi,
This was updated in 0.32.0 with the RegExp type moved to the [JavaScript]
type set to draw greater distinction between the regular expressions supported by Json Schema, and expressions supported by the full ECMA 262 syntax. The subset syntax supported by Json Schema (and Ajv) can be found here
The general recommendation is to use Type.String({ pattern: '...' }) to ensure compliance with the specification moving forward. However the RegExp type does enable full support of the full ECMA 262 syntax, including UTF-16 (Unicode) and flags at a cost of being "non-standard". As such, it only works with the TypeBox Value and TypeCompiler modules.
// The following expression cannot be encoded in Json Schema
const E = Type.RegExp(/<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu)
Value.Check(E, '♥️♦️♠️♣️') // true
Type.RegExp does enable international character set support options for users. But do still recommend Type.String({ pattern: '...' }) for most cases. For Ajv users, the above can be largely expressed via custom string format
.
Hope this helps!
S
from env-schema.
@climba03003 you're right we can close this issue.
At first I thought it was related to how fastify-env would interprete the ajv schema.
My bad on this one.
And thanks @sinclairzx81 for the clarification :)
from env-schema.
Related Issues (18)
- Add method for process env validation HOT 2
- Delete stale Greenkeeper branches HOT 4
- Can i use with dotenv-flow? HOT 3
- Use with fluent-json-schema now requires to call valueOf in ObjectSchema when using Typescript HOT 7
- A demo application with env-schema for reference - should we mention anywhere here to help others? HOT 2
- config.data in the README file has to be config.ALLOWED_HOSTS? HOT 1
- Typing `separator` with an array instead of just string
- Does not return value on Interpolation of variables HOT 2
- Expand environment variables HOT 3
- Migrate to fluent-json-schema in tests and docs HOT 2
- Add the support to add formats HOT 3
- Coverage 100% HOT 2
- Cast boolean from env variable HOT 3
- feature: allow custom ajv instance HOT 4
- Use Ajv.errorsText instead of errors.map, otherwise you loose context HOT 1
- TS: Open up envSchemaData HOT 2
- `customOptions` is not typed, so TypeScript is giving errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from env-schema.