mirror of
https://github.com/ritz078/transform.git
synced 2026-11-25 02:10:02 +03:00
add json schema to rust serde (#56)
* add json schema to rust serde * fixes * fixes
This commit is contained in:
1 parent
5d11840f16
commit
b690634565
7 files changed
+217
-59
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import registerPromiseWorker from 'promise-worker/register'
|
||||
import transform from 'transform-json-types'
|
||||
import jsf from 'json-schema-faker'
|
||||
|
||||
jsf.option({
|
||||
alwaysFakeOptionals: true
|
||||
})
|
||||
|
||||
registerPromiseWorker(
|
||||
code =>
|
||||
new Promise(resolve => {
|
||||
jsf.resolve(JSON.parse(code)).then(_json => {
|
||||
resolve(
|
||||
transform(_json, {
|
||||
lang: 'rust-serde'
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
)
|
||||
Reference in new issue
Block a user