Gathering detailed insights and metrics for fst-yup-to-json-schema
Gathering detailed insights and metrics for fst-yup-to-json-schema
Gathering detailed insights and metrics for fst-yup-to-json-schema
Gathering detailed insights and metrics for fst-yup-to-json-schema
npm install fst-yup-to-json-schema
Typescript
Module System
Node Version
NPM Version
TypeScript (98.28%)
JavaScript (1.72%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
13 Stars
39 Commits
8 Forks
2 Watchers
3 Branches
6 Contributors
Updated on Jun 02, 2024
Latest Version
1.0.10
Package Id
fst-yup-to-json-schema@1.0.10
Unpacked Size
53.79 kB
Size
10.54 kB
File Count
47
NPM Version
6.4.1
Node Version
10.15.0
Published on
Mar 14, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Yup is a library to validate the JSON input
JSON-Schema is a schema specification for JSON
This library converts Yup
schema to JSON-Schema
Since the original repository does not support conditional formatting we have prepared a fork of the repository https://github.com/sodaru/yup-to-json-schema.git
npm i fst-yup-to-json-schema
Run npm run example
1import yupToJsonSchema from "fst-yup-to-json-schema" 2 3// see Yup Specification for more options to create yupSchema 4import { object, string } from "yup"; 5import yupToJsonSchema, { initYupToJson } from "fst-yup-to-json-schema"; 6 7initYupToJson(); 8 9export const yupSchema = object({ 10 personType: string().required().oneOf(["person", "foreigner", "proxy", "foreignerProxy"]), 11 atr: string().required().oneOf(["AA", "BB"]), 12 name: string().required(), 13 //@ts-ignore 14 birthDate: string().when("personType", { 15 is: () => "foreignerProxy" || "foreigner", 16 key: 'birthDate', 17 then: (schema) => schema.required(), 18 }), 19 //@ts-ignore 20 birthNumber: string().when("personType", { 21 is: () => "person" || "proxy", 22 key: 'birthNumber', 23 then: (schema) => schema.required(), 24 }), 25 //@ts-ignore 26 aa: string().when("atr", { 27 is: "AA", 28 key: 'aa', 29 then: (schema) => schema.required(), 30 }), 31 //@ts-ignore 32 bb: string().when("atr", { 33 is: "BB", 34 key: 'bb', 35 then: (schema) => schema.required(), 36 }), 37}) 38 39const jsonSchema = yupToJsonSchema(yupSchema);
1{ 2 "type": "object", 3 "properties": { 4 "personType": { 5 "type": "string", 6 "enum": [ 7 "person", 8 "foreigner", 9 "proxy", 10 "foreignerProxy" 11 ] 12 }, 13 "atr": { 14 "type": "string", 15 "enum": [ 16 "AA", 17 "BB" 18 ] 19 }, 20 "name": { 21 "type": "string" 22 }, 23 "birthDate": { 24 "type": "string" 25 }, 26 "birthNumber": { 27 "type": "string" 28 }, 29 "aa": { 30 "type": "string" 31 }, 32 "bb": { 33 "type": "string" 34 } 35 }, 36 "required": [ 37 "personType", 38 "atr", 39 "name" 40 ], 41 "allOf": [ 42 { 43 "anyOf": [ 44 { 45 "properties": { 46 "personType": { 47 "const": "foreignerProxy" 48 } 49 }, 50 "required": [ 51 "birthDate" 52 ] 53 }, 54 { 55 "properties": { 56 "personType": { 57 "const": "foreigner" 58 } 59 }, 60 "required": [ 61 "birthDate" 62 ] 63 }, 64 { 65 "properties": { 66 "personType": { 67 "const": "person" 68 } 69 }, 70 "required": [ 71 "birthNumber" 72 ] 73 }, 74 { 75 "properties": { 76 "personType": { 77 "const": "proxy" 78 } 79 }, 80 "required": [ 81 "birthNumber" 82 ] 83 } 84 ] 85 }, 86 { 87 "anyOf": [ 88 { 89 "properties": { 90 "atr": { 91 "const": "AA" 92 } 93 }, 94 "required": [ 95 "aa" 96 ] 97 }, 98 { 99 "properties": { 100 "atr": { 101 "const": "BB" 102 } 103 }, 104 "required": [ 105 "bb" 106 ] 107 } 108 ] 109 } 110 ] 111}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 5/16 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More