├── .circleci └── config.yml ├── .gitignore ├── .releaserc.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib ├── add-properties.js ├── category-processors │ ├── choice.js │ ├── date-time.js │ ├── index.js │ ├── number.js │ ├── ref.js │ └── text.js ├── json-schema-builder.js └── utils │ ├── apply-choice-set-as-enum.js │ ├── apply-meta-attributes.js │ └── make-base.js ├── package.json ├── renovate.json └── test ├── builder-spec.js └── w2c-test.js /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | unit test: 4 | docker: 5 | - image: cimg/node:lts 6 | auth: 7 | username: $DOCKERHUB_USERNAME 8 | password: $DOCKERHUB_PASSWORD 9 | environment: 10 | TZ: "Europe/London" 11 | working_directory: ~/repo 12 | steps: 13 | - checkout 14 | - restore_cache: 15 | keys: 16 | - v1-deps-{{ checksum "package.json" }} 17 | - v1-deps- 18 | - run: 19 | name: install 20 | command: npm install 21 | - save_cache: 22 | key: v1-deps-{{ checksum "package.json" }} 23 | paths: 24 | - node_modules 25 | - run: 26 | name: test 27 | command: npm test 28 | - run: 29 | name: codecov 30 | command: npm run coverage 31 | lint: 32 | docker: 33 | - image: cimg/node:lts 34 | auth: 35 | username: $DOCKERHUB_USERNAME 36 | password: $DOCKERHUB_PASSWORD 37 | working_directory: ~/repo 38 | steps: 39 | - checkout 40 | - run: 41 | name: install standard 42 | command: npm install standard 43 | - run: 44 | name: lint 45 | command: npm run lint 46 | release: 47 | docker: 48 | - image: cimg/node:lts 49 | auth: 50 | username: $DOCKERHUB_USERNAME 51 | password: $DOCKERHUB_PASSWORD 52 | environment: 53 | TZ: "Europe/London" 54 | working_directory: ~/repo 55 | steps: 56 | - checkout 57 | - restore_cache: 58 | keys: 59 | - v1-deps-{{ checksum "package.json" }} 60 | - v1-deps- 61 | - run: 62 | name: install 63 | command: npm install 64 | - save_cache: 65 | key: v1-deps-{{ checksum "package.json" }} 66 | paths: 67 | - node_modules 68 | - run: 69 | name: release 70 | command: npx semantic-release 71 | workflows: 72 | version: 2 73 | test_and_release: 74 | jobs: 75 | - unit test: 76 | context: 77 | - docker-hub-creds 78 | - build-env-vars 79 | - lint: 80 | context: 81 | - docker-hub-creds 82 | - release: 83 | context: 84 | - docker-hub-creds 85 | - build-env-vars 86 | requires: 87 | - unit test 88 | - lint 89 | filters: 90 | branches: 91 | only: master 92 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | 27 | *.sqlite 28 | 29 | ## Node ### 30 | ~* 31 | .~* 32 | \#* 33 | 34 | # Logs 35 | logs 36 | *.log 37 | npm-debug.log* 38 | 39 | # Runtime data 40 | pids 41 | *.pid 42 | *.seed 43 | *.pid.lock 44 | 45 | # Directory for instrumented libs generated by jscoverage/JSCover 46 | lib-cov 47 | 48 | # Coverage directory used by tools like istanbul 49 | coverage 50 | 51 | # nyc test coverage 52 | .nyc_output 53 | 54 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 55 | .grunt 56 | 57 | # node-waf configuration 58 | .lock-wscript 59 | 60 | # Compiled binary addons (http://nodejs.org/api/addons.html) 61 | build/Release 62 | 63 | # Dependency directories 64 | node_modules 65 | jspm_packages 66 | 67 | # Optional npm cache directory 68 | .npm 69 | 70 | # Optional eslint cache 71 | .eslintcache 72 | 73 | # Optional REPL history 74 | .node_repl_history 75 | 76 | # Output of 'npm pack' 77 | *.tgz 78 | 79 | # Yarn Integrity file 80 | .yarn-integrity 81 | 82 | 83 | ## IDE things ## 84 | 85 | # Webstorm 86 | .idea 87 | 88 | # Eclipse: 89 | 90 | .project 91 | .metadata 92 | bin/ 93 | tmp/ 94 | *.tmp 95 | *.bak 96 | *.swp 97 | *~.nib 98 | local.properties 99 | .settings/ 100 | .loadpath 101 | .recommenders 102 | 103 | 104 | scratch.txt 105 | package-lock.json 106 | 107 | output/ 108 | fixtures/ 109 | w2c-test.js 110 | 111 | # Ignore Rush temporary files 112 | /common/temp/** 113 | 114 | package-deps.json 115 | 116 | .yo-rc.json 117 | 118 | lerna-debug.log 119 | 120 | TEST-result.xml 121 | .gradle/ 122 | .embedpostgresql/ 123 | build/ 124 | 125 | # Windows thumbnail cache files 126 | Thumbs.db 127 | ehthumbs.db 128 | ehthumbs_vista.db 129 | 130 | # Dump file 131 | *.stackdump 132 | 133 | # Folder config file 134 | [Dd]esktop.ini 135 | 136 | # Recycle Bin used on file shares 137 | $RECYCLE.BIN/ 138 | 139 | # Windows Installer files 140 | *.cab 141 | *.msi 142 | *.msix 143 | *.msm 144 | *.msp 145 | 146 | # Windows shortcuts 147 | *.lnk 148 | 149 | # OS generated files # 150 | ###################### 151 | .DS_Store 152 | .DS_Store? 153 | ._* 154 | .Spotlight-V100 155 | .Trashes 156 | ehthumbs.db 157 | Thumbs.db 158 | .LSOverride 159 | 160 | # Icon must end with two \r 161 | Icon 162 | 163 | 164 | # Thumbnails 165 | ._* 166 | 167 | # Files that might appear in the root of a volume 168 | .DocumentRevisions-V100 169 | .fseventsd 170 | .Spotlight-V100 171 | .TemporaryItems 172 | .Trashes 173 | .VolumeIcon.icns 174 | .com.apple.timemachine.donotpresent 175 | 176 | # Directories potentially created on remote AFP share 177 | .AppleDB 178 | .AppleDesktop 179 | Network Trash Folder 180 | Temporary Items 181 | .apdisk 182 | .apdisk 183 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "branch": "master", 3 | "analyzeCommits": { 4 | "preset": "angular", 5 | "releaseRules": [ 6 | { 7 | "type": "build", 8 | "scope": "deps", 9 | "release": "minor" 10 | } 11 | ] 12 | }, 13 | "verifyConditions": [ 14 | "@semantic-release/changelog", 15 | "@semantic-release/npm", 16 | "@semantic-release/git" 17 | ], 18 | "generateNotes": { 19 | "preset": "conventionalcommits", 20 | "presetConfig": { 21 | "types": [ 22 | { 23 | "breaking": true, 24 | "type": "feat!", 25 | "section": "BREAKING" 26 | }, 27 | { 28 | "type": "feat", 29 | "section": "New Feature(s) :rocket:" 30 | }, 31 | { 32 | "type": "fix", 33 | "section": "Bug Fix(es) :bug:" 34 | }, 35 | { 36 | "type": "docs", 37 | "section": "Documentation Changes :memo:" 38 | }, 39 | { 40 | "type": "refactor", 41 | "section": "Code Refactor :recycle:" 42 | }, 43 | { 44 | "type": "test", 45 | "section": "Tests :alembic:" 46 | }, 47 | { 48 | "type": "perf", 49 | "section": "Performance Improvement(s) :zap:" 50 | }, 51 | { 52 | "type": "build", 53 | "section": "Build system dependencies :hammer:" 54 | }, 55 | { 56 | "type": "chore", 57 | "section": "Chores :pencil2:" 58 | }, 59 | { 60 | "type": "ci", 61 | "section": "CICD Configuration Changes :construction_worker:" 62 | }, 63 | { 64 | "type": "style", 65 | "section": "Code Styling :art:" 66 | } 67 | ] 68 | } 69 | }, 70 | "prepare": [ 71 | { 72 | "path": "@semantic-release/changelog", 73 | "changelogFile": "CHANGELOG.md" 74 | }, 75 | { 76 | "path": "@semantic-release/git", 77 | "assets": [ 78 | "CHANGELOG.md" 79 | ] 80 | }, 81 | "@semantic-release/npm" 82 | ], 83 | "publish": [ 84 | "@semantic-release/npm", 85 | "@semantic-release/github" 86 | ], 87 | "success": [ 88 | "@semantic-release/github" 89 | ], 90 | "fail": [ 91 | "@semantic-release/github" 92 | ] 93 | } 94 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [1.27.0](https://github.com/wmfs/json-schema-builder/compare/v1.26.0...v1.27.0) (2023-06-20) 2 | 3 | 4 | ### 🛠 Builds 5 | 6 | * **deps:** update dependency dottie to v2.0.6 ([e3983af](https://github.com/wmfs/json-schema-builder/commit/e3983af1412c16e381efa468afa929f53e4cc463)) 7 | 8 | # [1.26.0](https://github.com/wmfs/json-schema-builder/compare/v1.25.0...v1.26.0) (2023-06-20) 9 | 10 | 11 | ### 🛠 Builds 12 | 13 | * **deps-dev:** update dependency [@semantic-release](https://github.com/semantic-release)/changelog to v6.0.3 ([333ae9a](https://github.com/wmfs/json-schema-builder/commit/333ae9a51198bdc79e48e24a4643b7b67a8c4575)) 14 | * **deps-dev:** update dependency rimraf to v4.4.1 ([98ae8d9](https://github.com/wmfs/json-schema-builder/commit/98ae8d99f494c389b1edfc6f62732c13d02000d4)) 15 | * **deps-dev:** update dependency rimraf to v5 ([b1a87a6](https://github.com/wmfs/json-schema-builder/commit/b1a87a6e891de636df8c67e326d9b12598d0bc08)) 16 | * **deps-dev:** update dependency rimraf to v5.0.1 ([055c441](https://github.com/wmfs/json-schema-builder/commit/055c44199c13a703d33840694c854ec85415de41)) 17 | * **deps-dev:** update dependency semantic-release to v20.1.3 ([45e7cbb](https://github.com/wmfs/json-schema-builder/commit/45e7cbb618f23739272de976c49e615ff8984bff)) 18 | * **deps-dev:** update dependency semantic-release to v21 ([b20b359](https://github.com/wmfs/json-schema-builder/commit/b20b3597cc4a6f628d976284cc89c93256a80596)) 19 | * **deps-dev:** update dependency semantic-release to v21.0.1 ([eedfca9](https://github.com/wmfs/json-schema-builder/commit/eedfca99a1541d2d60a3ab351f9099a0812026ef)) 20 | * **deps-dev:** update dependency semantic-release to v21.0.2 ([88d449d](https://github.com/wmfs/json-schema-builder/commit/88d449df5e5155245626d11b358bc5ca9dfe4183)) 21 | * **deps-dev:** update dependency semantic-release to v21.0.3 ([0e7a8a5](https://github.com/wmfs/json-schema-builder/commit/0e7a8a59034591061254f878721e15a06b81d108)) 22 | * **deps-dev:** update dependency semantic-release to v21.0.5 ([2cada87](https://github.com/wmfs/json-schema-builder/commit/2cada87443a48c757d33d36a979d97aeb09581f3)) 23 | * **deps-dev:** update dependency standard to v17.1.0 ([d054730](https://github.com/wmfs/json-schema-builder/commit/d054730332db3fb162feb55810c9ce50e7467533)) 24 | * **deps:** update dependency dottie to v2.0.4 [security] ([e86d68c](https://github.com/wmfs/json-schema-builder/commit/e86d68ce46815962b3d3edff0884d2fedd696f04)) 25 | 26 | # [1.25.0](https://github.com/wmfs/json-schema-builder/compare/v1.24.0...v1.25.0) (2023-03-13) 27 | 28 | 29 | ### 🛠 Builds 30 | 31 | * **deps:** update dependency mem-fs to v2.3.0 ([f4679e8](https://github.com/wmfs/json-schema-builder/commit/f4679e88f588b8cb57c8e7f46edde4538780a2ce)) 32 | 33 | # [1.24.0](https://github.com/wmfs/json-schema-builder/compare/v1.23.0...v1.24.0) (2023-03-13) 34 | 35 | 36 | ### 🛠 Builds 37 | 38 | * **deps-dev:** update dependency rimraf to v4 ([e96f5de](https://github.com/wmfs/json-schema-builder/commit/e96f5deb4e49cb0bd5db3bb3588ff34351860add)) 39 | * **deps-dev:** update dependency semantic-release to v20 ([15eb359](https://github.com/wmfs/json-schema-builder/commit/15eb359a025418797b9c5935e0f7b3276bfe1026)) 40 | * **deps:** update dependency mem-fs-editor to v9.7.0 ([298e623](https://github.com/wmfs/json-schema-builder/commit/298e6234190c90f7918cef742a222a368a0bb023)) 41 | 42 | # [1.23.0](https://github.com/wmfs/json-schema-builder/compare/v1.22.0...v1.23.0) (2023-03-13) 43 | 44 | 45 | ### 🛠 Builds 46 | 47 | * **deps-dev:** update dependency [@semantic-release](https://github.com/semantic-release)/changelog to v6.0.2 ([1ce9d63](https://github.com/wmfs/json-schema-builder/commit/1ce9d63f1183b122f82137a4f3ce1eb69c297f4d)) 48 | * **deps-dev:** update dependency chai to v4.3.7 ([2fa934c](https://github.com/wmfs/json-schema-builder/commit/2fa934ca5ef4369b52ef96d2c1c31bac00c155cd)) 49 | * **deps-dev:** update dependency mocha to v10.2.0 ([167232b](https://github.com/wmfs/json-schema-builder/commit/167232b987ab3be6908cbead35ee03d9c46830af)) 50 | * **deps:** update dependency dottie to v2.0.3 ([07d9f98](https://github.com/wmfs/json-schema-builder/commit/07d9f985d885e150e8644890f4e630315573305d)) 51 | 52 | # [1.22.0](https://github.com/wmfs/json-schema-builder/compare/v1.21.0...v1.22.0) (2022-11-02) 53 | 54 | 55 | ### 🛠 Builds 56 | 57 | * **deps:** update dependency mem-fs-editor to v9 ([73c8b0e](https://github.com/wmfs/json-schema-builder/commit/73c8b0e60759825ed0456348b28f649dccc06668)) 58 | 59 | # [1.21.0](https://github.com/wmfs/json-schema-builder/compare/v1.20.0...v1.21.0) (2022-11-01) 60 | 61 | 62 | ### 🛠 Builds 63 | 64 | * **deps-dev:** update dependency chai to v4.3.6 ([531b6cf](https://github.com/wmfs/json-schema-builder/commit/531b6cf3b47a0497757ce8b15e6207d7bcd2847c)) 65 | * **deps-dev:** update dependency mocha to v10 ([bb084b5](https://github.com/wmfs/json-schema-builder/commit/bb084b582a2637a05caba0c7a4adb541ae8a5235)) 66 | * **deps-dev:** update dependency mocha to v10.1.0 ([b9190da](https://github.com/wmfs/json-schema-builder/commit/b9190dabac36b2b6e4c8e51c4860bc53f1bbcfe5)) 67 | * **deps-dev:** update dependency mocha to v9.2.1 ([e8d0076](https://github.com/wmfs/json-schema-builder/commit/e8d0076984c75bbe4ed545873e603ea97e18bbd5)) 68 | * **deps-dev:** update dependency mocha to v9.2.2 ([ef7dd3d](https://github.com/wmfs/json-schema-builder/commit/ef7dd3db3a9cab0caa72a056e0a5a987464d1913)) 69 | * **deps-dev:** update dependency semantic-release to v19.0.3 ([d5a04be](https://github.com/wmfs/json-schema-builder/commit/d5a04bea88d49a2eefe3baeccc4f2ace4fbfae68)) 70 | * **deps-dev:** update dependency semantic-release to v19.0.5 ([c7ccb06](https://github.com/wmfs/json-schema-builder/commit/c7ccb06b0b066a7dfac64902d337d8f558167e31)) 71 | * **deps-dev:** update dependency standard to v17 ([ab21704](https://github.com/wmfs/json-schema-builder/commit/ab21704c8cfbbae6c4afbee5a3ff4aa0fc0799d5)) 72 | * **deps:** update dependency mem-fs to v2 ([f654c59](https://github.com/wmfs/json-schema-builder/commit/f654c59b6c95c376f9fdd906fba089a1d33a278d)) 73 | 74 | # [1.20.0](https://github.com/wmfs/json-schema-builder/compare/v1.19.0...v1.20.0) (2022-01-25) 75 | 76 | 77 | ### 🛠 Builds 78 | 79 | * **deps-dev:** bump chai from 4.3.0 to 4.3.1 ([fcab0d3](https://github.com/wmfs/json-schema-builder/commit/fcab0d324bf0bc6fe3f48f40bc41ae3331f93d30)) 80 | * **deps-dev:** bump chai from 4.3.1 to 4.3.2 ([d389171](https://github.com/wmfs/json-schema-builder/commit/d38917142c308ad5abefe5656737bb19e8ef9586)) 81 | * **deps-dev:** bump chai from 4.3.2 to 4.3.3 ([76a961b](https://github.com/wmfs/json-schema-builder/commit/76a961bdad1f3683f4dea029bc1a043ecf205650)) 82 | * **deps-dev:** bump chai from 4.3.3 to 4.3.4 ([e2838fb](https://github.com/wmfs/json-schema-builder/commit/e2838fbbbcdbb6a130be95ab74a7a97b07d8853b)) 83 | * **deps-dev:** bump codecov from 3.8.1 to 3.8.2 ([7e7d158](https://github.com/wmfs/json-schema-builder/commit/7e7d158520de2d42b8110c4ca267da2c2608da8b)) 84 | * **deps-dev:** bump codecov from 3.8.2 to 3.8.3 ([8e9bb62](https://github.com/wmfs/json-schema-builder/commit/8e9bb62c29d62fe21fd5a88033fca60dedec8b0b)) 85 | * **deps-dev:** bump mocha from 8.3.0 to 8.3.1 ([a1ccd0c](https://github.com/wmfs/json-schema-builder/commit/a1ccd0c5250c3803033d17f72cba38df7e956883)) 86 | * **deps-dev:** bump mocha from 8.3.1 to 8.3.2 ([e18c952](https://github.com/wmfs/json-schema-builder/commit/e18c952add9c2079be74f51094ccc1c678a36c9b)) 87 | * **deps-dev:** bump mocha from 8.3.2 to 8.4.0 ([275e64c](https://github.com/wmfs/json-schema-builder/commit/275e64c837db7af563ec02d75fb5b0245660e62e)) 88 | * **deps-dev:** bump mocha from 8.4.0 to 9.0.0 ([84ba3ff](https://github.com/wmfs/json-schema-builder/commit/84ba3ffdfa2871ce32fb011c4ff733e3eae0f94e)) 89 | * **deps-dev:** bump mocha from 9.0.0 to 9.0.1 ([8e17c96](https://github.com/wmfs/json-schema-builder/commit/8e17c96a43e5636bb419ff9ee55272a9cdae6592)) 90 | * **deps-dev:** bump mocha from 9.0.1 to 9.0.2 ([ef9d50e](https://github.com/wmfs/json-schema-builder/commit/ef9d50eb3d27273a60ceaf2e861b7626c3215d2e)) 91 | * **deps-dev:** bump mocha from 9.0.2 to 9.0.3 ([245b623](https://github.com/wmfs/json-schema-builder/commit/245b6238ec8122b75058be8cd3452160cc233876)) 92 | * **deps-dev:** bump semantic-release from 17.3.9 to 17.4.0 ([5694107](https://github.com/wmfs/json-schema-builder/commit/5694107d3827a735a0b5409e6429f3cec6d92109)) 93 | * **deps-dev:** bump semantic-release from 17.4.0 to 17.4.1 ([40130df](https://github.com/wmfs/json-schema-builder/commit/40130dfb257fbb5570c986a752b4f7dee9238548)) 94 | * **deps-dev:** bump semantic-release from 17.4.1 to 17.4.2 ([0cb2a94](https://github.com/wmfs/json-schema-builder/commit/0cb2a943e7ce8a04c8a772a0cfc6f0007b4f48c7)) 95 | * **deps-dev:** bump semantic-release from 17.4.2 to 17.4.3 ([7814bf3](https://github.com/wmfs/json-schema-builder/commit/7814bf38c42a571bf1c2957287d2eb8c616969be)) 96 | * **deps-dev:** bump semantic-release from 17.4.3 to 17.4.4 ([14e8944](https://github.com/wmfs/json-schema-builder/commit/14e8944ce3abb45384986e4e5eeb1bdea07bae4b)) 97 | * **deps-dev:** pin dependency rimraf to 3.0.2 ([cdc2b40](https://github.com/wmfs/json-schema-builder/commit/cdc2b4048e0cae775ec0a31a09f3e725cbcc4223)) 98 | * **deps-dev:** update dependency [@semantic-release](https://github.com/semantic-release)/changelog to v6 ([0ff697c](https://github.com/wmfs/json-schema-builder/commit/0ff697ca8849f2d2382503d73ec786b452189c2c)) 99 | * **deps-dev:** update dependency [@semantic-release](https://github.com/semantic-release)/git to v10 ([775669e](https://github.com/wmfs/json-schema-builder/commit/775669edea1e7f222d8bb9bfaf9eb46061d079b8)) 100 | * **deps-dev:** update dependency [@semantic-release](https://github.com/semantic-release)/git to v9.0.1 ([0be3dad](https://github.com/wmfs/json-schema-builder/commit/0be3dad72af2c32e4635e02912e12a6054f29115)) 101 | * **deps-dev:** update dependency mocha to v9.1.0 ([0b11d0f](https://github.com/wmfs/json-schema-builder/commit/0b11d0faff9dbd07a11393abf14ed918eb44c377)) 102 | * **deps-dev:** update dependency mocha to v9.1.1 ([f8b923a](https://github.com/wmfs/json-schema-builder/commit/f8b923af29d8b7bf2c72baf7af1d82798c5a744f)) 103 | * **deps-dev:** update dependency mocha to v9.1.2 ([5de79af](https://github.com/wmfs/json-schema-builder/commit/5de79af3aecae6f24f5f518f1da3e82353ed7055)) 104 | * **deps-dev:** update dependency mocha to v9.1.3 ([8bc02de](https://github.com/wmfs/json-schema-builder/commit/8bc02ded94a9a7f5eb229ac879dcaeee6174c97f)) 105 | * **deps-dev:** update dependency mocha to v9.1.4 ([127244a](https://github.com/wmfs/json-schema-builder/commit/127244a0e0456bba3dc6f5775f9c48eb389de0b2)) 106 | * **deps-dev:** update dependency mocha to v9.2.0 ([b475337](https://github.com/wmfs/json-schema-builder/commit/b4753371dadb567387c955919e5cf8b300431854)) 107 | * **deps-dev:** update dependency semantic-release to v17.4.5 ([a499cd0](https://github.com/wmfs/json-schema-builder/commit/a499cd0f310ac514170f23394f253ace1aeb149c)) 108 | * **deps-dev:** update dependency semantic-release to v17.4.6 ([acc1727](https://github.com/wmfs/json-schema-builder/commit/acc17270660d6317c1dea7ba1efd2478d72f3084)) 109 | * **deps-dev:** update dependency semantic-release to v17.4.7 ([d9da3fa](https://github.com/wmfs/json-schema-builder/commit/d9da3fa55ba4b3a1b4f116a3fdbd2b88b361cda8)) 110 | * **deps-dev:** update dependency semantic-release to v18 ([39370bd](https://github.com/wmfs/json-schema-builder/commit/39370bdc82812a05515ca5d82c119bdc303ab996)) 111 | * **deps-dev:** update dependency semantic-release to v18.0.1 ([2179cee](https://github.com/wmfs/json-schema-builder/commit/2179cee17abfb70779d3731df75d27048b6eb660)) 112 | * **deps-dev:** update dependency semantic-release to v19 ([6ba403f](https://github.com/wmfs/json-schema-builder/commit/6ba403f31b7d6693ec1fc3dd1486fb3bd3f1903d)) 113 | * **deps-dev:** update dependency standard to v16.0.4 ([483fab6](https://github.com/wmfs/json-schema-builder/commit/483fab6b10345999de6838ba259cdd5f3dc08ef1)) 114 | * **deps-dev:** update semantic-release monorepo ([9f2d74f](https://github.com/wmfs/json-schema-builder/commit/9f2d74f5e18db58c08436f10622d742c0513c39a)) 115 | * **deps:** update dependency mem-fs-editor to v8.1.2 ([5f14a2f](https://github.com/wmfs/json-schema-builder/commit/5f14a2f91b90ca8e9f753ad445ad77363765a638)) 116 | 117 | 118 | ### ♻️ Chores 119 | 120 | * add renovate config [ch6600] ([2959987](https://github.com/wmfs/json-schema-builder/commit/2959987175e2da4128ba8c09c464f0c4fb2d8926)) 121 | 122 | # [1.19.0](https://github.com/wmfs/json-schema-builder/compare/v1.18.0...v1.19.0) (2021-02-24) 123 | 124 | 125 | ### 🛠 Builds 126 | 127 | * **deps:** bump lodash from 4.17.20 to 4.17.21 ([05373d2](https://github.com/wmfs/json-schema-builder/commit/05373d268c220d6fbbf72da761366593e736584e)) 128 | * **deps-dev:** bump chai from 4.2.0 to 4.3.0 ([a50ebde](https://github.com/wmfs/json-schema-builder/commit/a50ebde7ed2aa18111a5ae7064bfcc64adc5941d)) 129 | * **deps-dev:** bump mocha from 8.2.1 to 8.3.0 ([1bca038](https://github.com/wmfs/json-schema-builder/commit/1bca038c38c489321472d4355717da84e05b6177)) 130 | * **deps-dev:** bump semantic-release from 17.3.1 to 17.3.2 ([e4b3b78](https://github.com/wmfs/json-schema-builder/commit/e4b3b78ed1e86bc639780752fd4237246b5153fd)) 131 | * **deps-dev:** bump semantic-release from 17.3.2 to 17.3.3 ([975acc6](https://github.com/wmfs/json-schema-builder/commit/975acc6fa9025fbd7fa298e7b9c138ae136e6ad9)) 132 | * **deps-dev:** bump semantic-release from 17.3.3 to 17.3.4 ([8fd06fb](https://github.com/wmfs/json-schema-builder/commit/8fd06fb3b5ffd44a8172761af0fcad8f97d68d85)) 133 | * **deps-dev:** bump semantic-release from 17.3.4 to 17.3.5 ([5270fdd](https://github.com/wmfs/json-schema-builder/commit/5270fdd0f69496cc734fea384661fc077820ce43)) 134 | * **deps-dev:** bump semantic-release from 17.3.5 to 17.3.6 ([90d158d](https://github.com/wmfs/json-schema-builder/commit/90d158dc7ee419a775255eb881af835fece53629)) 135 | * **deps-dev:** bump semantic-release from 17.3.6 to 17.3.7 ([660ef85](https://github.com/wmfs/json-schema-builder/commit/660ef85248c8f499255cd4254f89e1eb675f547d)) 136 | * **deps-dev:** bump semantic-release from 17.3.7 to 17.3.8 ([8b11a0d](https://github.com/wmfs/json-schema-builder/commit/8b11a0dc112b86dd172d69b60e61215568ce8341)) 137 | * **deps-dev:** bump semantic-release from 17.3.8 to 17.3.9 ([76cd06c](https://github.com/wmfs/json-schema-builder/commit/76cd06cf75152f106600905523acc563deaae129)) 138 | 139 | # [1.18.0](https://github.com/wmfs/json-schema-builder/compare/v1.17.0...v1.18.0) (2021-01-12) 140 | 141 | 142 | ### 🛠 Builds 143 | 144 | * **deps:** bump mem-fs-editor from 7.0.1 to 8.0.0 ([38b98e7](https://github.com/wmfs/json-schema-builder/commit/38b98e7894df0dd87ebfe96a6030e497c22e23fa)) 145 | * **deps-dev:** bump codecov from 3.7.2 to 3.8.0 ([c46ba6b](https://github.com/wmfs/json-schema-builder/commit/c46ba6b56fc014871fda81d232a6a0da9e062b93)) 146 | * **deps-dev:** bump codecov from 3.8.0 to 3.8.1 ([bf60a2e](https://github.com/wmfs/json-schema-builder/commit/bf60a2e42400a0fc455726b36106dcd8b75954d1)) 147 | * **deps-dev:** bump cz-conventional-changelog from 3.2.0 to 3.2.1 ([70ce763](https://github.com/wmfs/json-schema-builder/commit/70ce76353fe8cecb4b0583e4bbd0268533872623)) 148 | * **deps-dev:** bump cz-conventional-changelog from 3.2.1 to 3.3.0 ([f800715](https://github.com/wmfs/json-schema-builder/commit/f800715f0012aa969f078a1152cf05e8b665c033)) 149 | * **deps-dev:** bump mocha from 8.1.1 to 8.1.2 ([e5a8a0c](https://github.com/wmfs/json-schema-builder/commit/e5a8a0cf6bae763f535ff92b116232dd78db6dcf)) 150 | * **deps-dev:** bump mocha from 8.1.2 to 8.1.3 ([826e513](https://github.com/wmfs/json-schema-builder/commit/826e513d9a4cf9eec3cf05a6be5a566b96af1379)) 151 | * **deps-dev:** bump mocha from 8.1.3 to 8.2.0 ([1af058d](https://github.com/wmfs/json-schema-builder/commit/1af058d24fe23e232fc4ecab3c6a482c099341e9)) 152 | * **deps-dev:** bump mocha from 8.2.0 to 8.2.1 ([45caaa1](https://github.com/wmfs/json-schema-builder/commit/45caaa1bee8c4ea3acec3691c2cb38361d8b0df9)) 153 | * **deps-dev:** bump semantic-release from 17.1.1 to 17.1.2 ([b36e1de](https://github.com/wmfs/json-schema-builder/commit/b36e1deca3f17c843b89b20407afb3bb35b91351)) 154 | * **deps-dev:** bump semantic-release from 17.1.2 to 17.2.0 ([919caf3](https://github.com/wmfs/json-schema-builder/commit/919caf3f7d4303eec5dbb930cbb10b57f7136f31)) 155 | * **deps-dev:** bump semantic-release from 17.2.0 to 17.2.1 ([3e0f3d2](https://github.com/wmfs/json-schema-builder/commit/3e0f3d27dd65dc24f575e0ac2366d2821d3ccaf8)) 156 | * **deps-dev:** bump semantic-release from 17.2.1 to 17.2.2 ([32af717](https://github.com/wmfs/json-schema-builder/commit/32af717d9ca08b4f778cdc41ccfba9633529aece)) 157 | * **deps-dev:** bump semantic-release from 17.2.2 to 17.2.3 ([7dbe4d8](https://github.com/wmfs/json-schema-builder/commit/7dbe4d8f639e8587d17cbf700905b8f80698c083)) 158 | * **deps-dev:** bump semantic-release from 17.2.3 to 17.2.4 ([92f2263](https://github.com/wmfs/json-schema-builder/commit/92f22639587d71110ef3f45b7d6e884d9617c88a)) 159 | * **deps-dev:** bump semantic-release from 17.2.4 to 17.3.0 ([5448469](https://github.com/wmfs/json-schema-builder/commit/5448469a6796a08afa80467a1c7520ec90424af2)) 160 | * **deps-dev:** bump semantic-release from 17.3.0 to 17.3.1 ([f6bf3a0](https://github.com/wmfs/json-schema-builder/commit/f6bf3a0398d428e65471601cc4c8e625ef4b43aa)) 161 | * **deps-dev:** bump standard from 14.3.4 to 15.0.0 ([6493e4c](https://github.com/wmfs/json-schema-builder/commit/6493e4c9b4abd8a71d07d750c63e30e7219fbb0b)) 162 | * **deps-dev:** bump standard from 15.0.0 to 15.0.1 ([a643276](https://github.com/wmfs/json-schema-builder/commit/a6432769896383473fd18e7410097f91064fd53a)) 163 | * **deps-dev:** bump standard from 15.0.1 to 16.0.0 ([43cce84](https://github.com/wmfs/json-schema-builder/commit/43cce849b0cd2326e391a7433e74b0c260540a23)) 164 | * **deps-dev:** bump standard from 16.0.0 to 16.0.1 ([7089aaa](https://github.com/wmfs/json-schema-builder/commit/7089aaa54784aa579a58e4e9a54f09dfdded9d0e)) 165 | * **deps-dev:** bump standard from 16.0.1 to 16.0.2 ([c5ee630](https://github.com/wmfs/json-schema-builder/commit/c5ee6307deebe2d32f56d1085bc0c9e55c9e5f1b)) 166 | * **deps-dev:** bump standard from 16.0.2 to 16.0.3 ([8e43bb9](https://github.com/wmfs/json-schema-builder/commit/8e43bb9a84856d02de15ced9c07ccf2de79e01d7)) 167 | 168 | 169 | ### ⚙️ Continuous Integrations 170 | 171 | * **circle:** authenticate Docker image pull [ch2767] ([7f939e9](https://github.com/wmfs/json-schema-builder/commit/7f939e94749ddacd49d3052c3bde2d4ebd2fa03a)) 172 | * **circle:** cache dependencies [ch2770] ([241322f](https://github.com/wmfs/json-schema-builder/commit/241322f003ef3a67b7da83c1473eb22d9c4c0888)) 173 | * **circle:** separate linting job [ch1009] ([0f916ce](https://github.com/wmfs/json-schema-builder/commit/0f916ceba91187ae2507e8495a96002b1cd83745)) 174 | * **circle:** update build environment variable context name [ch2771] ([4d4dafc](https://github.com/wmfs/json-schema-builder/commit/4d4dafc8e6b09547dcc9f3c18342cd83b3931c14)) 175 | 176 | # [1.17.0](https://github.com/wmfs/json-schema-builder/compare/v1.16.0...v1.17.0) (2020-08-17) 177 | 178 | 179 | ### 🛠 Builds 180 | 181 | * **deps:** bump lodash from 4.17.19 to 4.17.20 ([7201a29](https://github.com/wmfs/json-schema-builder/commit/7201a299854cc73cfcca223d93aa38c2e28e46e5)) 182 | * **deps-dev:** bump codecov from 3.7.0 to 3.7.1 ([700f1cb](https://github.com/wmfs/json-schema-builder/commit/700f1cbc2d7c942367ccb501888199f474c65b68)) 183 | * **deps-dev:** bump codecov from 3.7.1 to 3.7.2 ([cb78c58](https://github.com/wmfs/json-schema-builder/commit/cb78c587529acaeacaa3fd94cd5a59cb3d08a2e0)) 184 | * **deps-dev:** bump mocha from 8.0.1 to 8.1.0 ([e62e045](https://github.com/wmfs/json-schema-builder/commit/e62e0450eac6f509d0af6b9a61c2e7e62781d436)) 185 | * **deps-dev:** bump mocha from 8.1.0 to 8.1.1 ([bc99da7](https://github.com/wmfs/json-schema-builder/commit/bc99da7c613837de26428bb36c8c34601981751f)) 186 | 187 | 188 | ### ⚙️ Continuous Integrations 189 | 190 | * **circle:** separate lint job [ch1009] ([6379016](https://github.com/wmfs/json-schema-builder/commit/63790160ac6651be8bc65b2a231d2259f667dd56)) 191 | 192 | # [1.16.0](https://github.com/wmfs/json-schema-builder/compare/v1.15.0...v1.16.0) (2020-07-16) 193 | 194 | 195 | ### 🛠 Builds 196 | 197 | * **deps:** bump mem-fs-editor from 6.0.0 to 7.0.1 ([3f39294](https://github.com/wmfs/json-schema-builder/commit/3f3929439c845f49ae49513d118e389621f7bd86)) 198 | 199 | # [1.15.0](https://github.com/wmfs/json-schema-builder/compare/v1.14.0...v1.15.0) (2020-07-16) 200 | 201 | 202 | ### 🛠 Builds 203 | 204 | * **deps:** bump mem-fs from 1.1.3 to 1.2.0 ([a1af61e](https://github.com/wmfs/json-schema-builder/commit/a1af61e7e5afa2fd7d10822b8178c892dd420ba3)) 205 | 206 | # [1.14.0](https://github.com/wmfs/json-schema-builder/compare/v1.13.0...v1.14.0) (2020-07-13) 207 | 208 | 209 | ### 🛠 Builds 210 | 211 | * **deps:** bump lodash from 4.17.15 to 4.17.19 ([205edbe](https://github.com/wmfs/json-schema-builder/commit/205edbe52539a42d91381412baace62aad650f29)) 212 | * **deps-dev:** bump [@semantic-release](https://github.com/semantic-release)/changelog from 5.0.0 to 5.0.1 ([27cc492](https://github.com/wmfs/json-schema-builder/commit/27cc4927074a62add98f361fcabe183ed08990ad)) 213 | * **deps-dev:** bump codecov from 3.6.2 to 3.6.3 ([0572fe9](https://github.com/wmfs/json-schema-builder/commit/0572fe9eaceba7e1b5dc584d24a391a1d5abfaa2)) 214 | * **deps-dev:** bump codecov from 3.6.3 to 3.6.4 ([4b8ff4f](https://github.com/wmfs/json-schema-builder/commit/4b8ff4fe832142c037c446561cc526746122e82d)) 215 | * **deps-dev:** bump codecov from 3.6.4 to 3.6.5 ([0c1354d](https://github.com/wmfs/json-schema-builder/commit/0c1354d345b1adcfaa34f8a20551773e5ce8d34a)) 216 | * **deps-dev:** bump codecov from 3.6.5 to 3.7.0 ([6d89b32](https://github.com/wmfs/json-schema-builder/commit/6d89b329061bbe8a4ad9fb811892d0b439bf8cac)) 217 | * **deps-dev:** bump conventional-changelog-metahub from 4.0.0 to 4.0.1 ([73b9cf0](https://github.com/wmfs/json-schema-builder/commit/73b9cf0eb27fce46d2143c83c5828ecf9e9def5c)) 218 | * **deps-dev:** bump cz-conventional-changelog from 3.0.2 to 3.0.3 ([ae3a020](https://github.com/wmfs/json-schema-builder/commit/ae3a0205289da6e4acc0c0c7c64c0347b4598fe7)) 219 | * **deps-dev:** bump cz-conventional-changelog from 3.0.3 to 3.1.0 ([9c81321](https://github.com/wmfs/json-schema-builder/commit/9c813217249c51eca5ec82876594397864a9f0b8)) 220 | * **deps-dev:** bump cz-conventional-changelog from 3.1.0 to 3.2.0 ([3ebf755](https://github.com/wmfs/json-schema-builder/commit/3ebf755deec616b2c65eba0ed1bca0ce4fa5904d)) 221 | * **deps-dev:** bump mocha from 7.0.1 to 7.1.0 ([3825601](https://github.com/wmfs/json-schema-builder/commit/3825601d2ed72a267036e21551840ee4af11d3d3)) 222 | * **deps-dev:** bump mocha from 7.1.0 to 7.1.1 ([f0ab566](https://github.com/wmfs/json-schema-builder/commit/f0ab566f4f599e35ed669b9e7ae0053acae491d7)) 223 | * **deps-dev:** bump mocha from 7.1.1 to 7.1.2 ([074b2e0](https://github.com/wmfs/json-schema-builder/commit/074b2e0cb7fddc8075245611d43461d367f4608d)) 224 | * **deps-dev:** bump mocha from 7.1.2 to 7.2.0 ([56a2e37](https://github.com/wmfs/json-schema-builder/commit/56a2e37855ec5775373255804dc367cc030679a3)) 225 | * **deps-dev:** bump mocha from 7.2.0 to 8.0.1 ([237b317](https://github.com/wmfs/json-schema-builder/commit/237b3175a7d018ab58df0cc3e611d48faa106946)) 226 | * **deps-dev:** bump nyc from 15.0.0 to 15.0.1 ([551f492](https://github.com/wmfs/json-schema-builder/commit/551f4920e67a925a5dcfbd849c3c400edc70eb10)) 227 | * **deps-dev:** bump nyc from 15.0.1 to 15.1.0 ([ed6031f](https://github.com/wmfs/json-schema-builder/commit/ed6031f039b38e4b3b1b9efb2543ba8b6bc5d255)) 228 | * **deps-dev:** bump semantic-release from 17.0.4 to 17.0.5 ([c4a4b3b](https://github.com/wmfs/json-schema-builder/commit/c4a4b3b175ce079046b7c0d4d2af2ee76573f250)) 229 | * **deps-dev:** bump semantic-release from 17.0.5 to 17.0.6 ([891c91c](https://github.com/wmfs/json-schema-builder/commit/891c91c3ce908a42df96e30e954c6a8567cfdf69)) 230 | * **deps-dev:** bump semantic-release from 17.0.6 to 17.0.7 ([e3325b0](https://github.com/wmfs/json-schema-builder/commit/e3325b01aaf1ce6464a2bcb8476c8949e007d215)) 231 | * **deps-dev:** bump semantic-release from 17.0.7 to 17.0.8 ([acd16e4](https://github.com/wmfs/json-schema-builder/commit/acd16e4d595cc9e07d6112e961cf807ebf802621)) 232 | * **deps-dev:** bump semantic-release from 17.0.8 to 17.1.0 ([1932d07](https://github.com/wmfs/json-schema-builder/commit/1932d075f172c1c2971a02288af44e27346cec48)) 233 | * **deps-dev:** bump semantic-release from 17.1.0 to 17.1.1 ([183c677](https://github.com/wmfs/json-schema-builder/commit/183c677f1ccb4fcdf6367fed4546c55eae76b541)) 234 | * **deps-dev:** bump standard from 14.3.1 to 14.3.2 ([239f7b5](https://github.com/wmfs/json-schema-builder/commit/239f7b58e40bfa4dc7bb87b694b6af3eda6f3819)) 235 | * **deps-dev:** bump standard from 14.3.2 to 14.3.3 ([657ee29](https://github.com/wmfs/json-schema-builder/commit/657ee2915217ca7cddcbf5bccdc271086df3d7bc)) 236 | * **deps-dev:** bump standard from 14.3.3 to 14.3.4 ([97b607b](https://github.com/wmfs/json-schema-builder/commit/97b607b0fe59a047a1c322c57aca3fd2825ed07a)) 237 | * **deps-dev:** update semantic-release dev dependencies ([ebf2ba6](https://github.com/wmfs/json-schema-builder/commit/ebf2ba64fef8281e7173549b960bf2866e93abbb)) 238 | 239 | 240 | ### ⚙️ Continuous Integrations 241 | 242 | * **circle:** add context env var config to config.yml ([800df9b](https://github.com/wmfs/json-schema-builder/commit/800df9b968adf436f0277b60fa57563418d88722)) 243 | * **circle:** use updated circle node image [skip ci] ([67b5ff0](https://github.com/wmfs/json-schema-builder/commit/67b5ff06fb279919b96884d95310772671585cdb)) 244 | 245 | # [1.13.0](https://github.com/wmfs/json-schema-builder/compare/v1.12.0...v1.13.0) (2020-01-28) 246 | 247 | 248 | ### 🛠 Builds 249 | 250 | * **deps:** bump dottie from 2.0.1 to 2.0.2 ([7c465f2](https://github.com/wmfs/json-schema-builder/commit/7c465f21203b5b481ecb2fb2d8f33eb3c75fe35f)) 251 | 252 | # [1.12.0](https://github.com/wmfs/json-schema-builder/compare/v1.11.0...v1.12.0) (2020-01-28) 253 | 254 | 255 | ### 🛠 Builds 256 | 257 | * **deps:** bump [@wmfs](https://github.com/wmfs)/tymly-data-types from 1.3.0 to 1.5.0 ([c037398](https://github.com/wmfs/json-schema-builder/commit/c03739893305b6a19678131336252415d49d51bc)) 258 | 259 | # [1.11.0](https://github.com/wmfs/json-schema-builder/compare/v1.10.0...v1.11.0) (2020-01-28) 260 | 261 | 262 | ### 🛠 Builds 263 | 264 | * **deps:** [security] bump lodash from 4.17.11 to 4.17.15 ([46fa094](https://github.com/wmfs/json-schema-builder/commit/46fa094d0511182e33426176d19a83fc6f1fb0af)) 265 | 266 | # [1.10.0](https://github.com/wmfs/json-schema-builder/compare/v1.9.0...v1.10.0) (2020-01-28) 267 | 268 | 269 | ### 🛠 Builds 270 | 271 | * **deps:** bump mem-fs-editor from 4.0.0 to 6.0.0 ([768cfd5](https://github.com/wmfs/json-schema-builder/commit/768cfd5a41528d26d68ca75b928228f0054535fb)) 272 | * **deps-dev:** bump [@semantic-release](https://github.com/semantic-release)/changelog from 3.0.6 to 5.0.0 ([07a2545](https://github.com/wmfs/json-schema-builder/commit/07a25457f13290314b61b4bb3eff1a76d76d8f73)) 273 | * **deps-dev:** bump codecov from 3.6.1 to 3.6.2 ([941e787](https://github.com/wmfs/json-schema-builder/commit/941e7873cce182db98cf915ed0091b95b2129d5f)) 274 | * **deps-dev:** bump conventional-changelog-metahub from 3.0.0 to 4.0.0 ([6aee54e](https://github.com/wmfs/json-schema-builder/commit/6aee54e9747aa080ef04ecba8ceced9fe0ab0ed3)) 275 | * **deps-dev:** bump mocha from 6.2.2 to 7.0.1 ([8b58441](https://github.com/wmfs/json-schema-builder/commit/8b5844137f9a7aba795298ba9e7a65a0027479ad)) 276 | 277 | # [1.9.0](https://github.com/wmfs/json-schema-builder/compare/v1.8.0...v1.9.0) (2020-01-27) 278 | 279 | 280 | ### ✨ Features 281 | 282 | * Add in w2c modules ([ed205e2](https://github.com/wmfs/json-schema-builder/commit/ed205e29adba8bd67478e3e80ba82e2f160b2c9a)) 283 | 284 | 285 | ### 🛠 Builds 286 | 287 | * **deps-dev:** bump packages ([b77b5ea](https://github.com/wmfs/json-schema-builder/commit/b77b5eae9fdf62024a4f6c17963e7ec4f94b364b)) 288 | * **deps-dev:** bump standard from 12.0.1 to 14.3.1 ([b09f947](https://github.com/wmfs/json-schema-builder/commit/b09f94796115e8bccf3810b22cf55d7fd8b8823e)) 289 | * **deps-dev:** update dev dependancies ([dc0c6e1](https://github.com/wmfs/json-schema-builder/commit/dc0c6e1eb7bd988e243f5b4deb39796fbc894360)) 290 | 291 | 292 | ### 📚 Documentation 293 | 294 | * Add CircleCI badge ([401fb22](https://github.com/wmfs/json-schema-builder/commit/401fb22dedc11affde6c46612f15090e0add87c5)) 295 | 296 | 297 | ### 🚨 Tests 298 | 299 | * comment out test due to missing fixtures ([52944a3](https://github.com/wmfs/json-schema-builder/commit/52944a326a946fc8ae35e9d58d0faeaee2c8e33a)) 300 | 301 | 302 | ### ⚙️ Continuous Integrations 303 | 304 | * **circle:** Add CircleCI config ([6f73a42](https://github.com/wmfs/json-schema-builder/commit/6f73a4235a11875bc2b3a8f20060c50fdcd772bf)) 305 | * **travis:** Remove Travis config ([08eb8a4](https://github.com/wmfs/json-schema-builder/commit/08eb8a4b7bce0639ce83a7d4139ae3a4247f2a47)) 306 | 307 | 308 | ### 💎 Styles 309 | 310 | * Do not access Object.prototype method 'hasOwnProperty' from target object ([1fa9be8](https://github.com/wmfs/json-schema-builder/commit/1fa9be838800cb50f0dd291a6b9c6ed2456d9367)) 311 | * standard --fix ([2dd9e96](https://github.com/wmfs/json-schema-builder/commit/2dd9e962ae89db0d6510805b7dd7d872f1725b95)) 312 | 313 | # [1.8.0](https://github.com/wmfs/json-schema-builder/compare/v1.7.0...v1.8.0) (2019-06-20) 314 | 315 | 316 | ### ✨ Features 317 | 318 | * add in compatibility for validation, tooltips and autosetters ([b0fa738](https://github.com/wmfs/json-schema-builder/commit/b0fa738)) 319 | 320 | # [1.7.0](https://github.com/wmfs/json-schema-builder/compare/v1.6.0...v1.7.0) (2019-06-12) 321 | 322 | 323 | ### ✨ Features 324 | 325 | * add compatibility for cardscript showWhen parsing ([8a5d496](https://github.com/wmfs/json-schema-builder/commit/8a5d496)) 326 | 327 | # [1.6.0](https://github.com/wmfs/json-schema-builder/compare/v1.5.0...v1.6.0) (2019-06-05) 328 | 329 | 330 | ### ✨ Features 331 | 332 | * update package for workbook to cardscript conversion ([250e5f8](https://github.com/wmfs/json-schema-builder/commit/250e5f8)) 333 | 334 | # [1.5.0](https://github.com/wmfs/json-schema-builder/compare/v1.4.0...v1.5.0) (2019-02-14) 335 | 336 | 337 | ### ✨ Features 338 | 339 | * Include typeHint in model output ([11d080b](https://github.com/wmfs/json-schema-builder/commit/11d080b)) 340 | 341 | # [1.4.0](https://github.com/wmfs/json-schema-builder/compare/v1.3.0...v1.4.0) (2019-02-13) 342 | 343 | 344 | ### 🛠 Builds 345 | 346 | * **deps:** Bump tymly-data-types ([82538a6](https://github.com/wmfs/json-schema-builder/commit/82538a6)) 347 | 348 | 349 | ### 📦 Code Refactoring 350 | 351 | * Pull exports together ([cd98c96](https://github.com/wmfs/json-schema-builder/commit/cd98c96)) 352 | 353 | # [1.3.0](https://github.com/wmfs/json-schema-builder/compare/v1.2.0...v1.3.0) (2019-02-12) 354 | 355 | 356 | ### ✨ Features 357 | 358 | * Refactor to use tymly-data-types. ([20ddb54](https://github.com/wmfs/json-schema-builder/commit/20ddb54)) 359 | 360 | 361 | ### 🐛 Bug Fixes 362 | 363 | * Dependency bump. ([2bf8f6e](https://github.com/wmfs/json-schema-builder/commit/2bf8f6e)) 364 | * Remove debug logging. ([b9915cd](https://github.com/wmfs/json-schema-builder/commit/b9915cd)) 365 | 366 | # [1.2.0](https://github.com/wmfs/json-schema-builder/compare/v1.1.0...v1.2.0) (2019-01-17) 367 | 368 | 369 | ### ✨ Features 370 | 371 | * Expose list of available types ([80a58b7](https://github.com/wmfs/json-schema-builder/commit/80a58b7)) 372 | 373 | # [1.1.0](https://github.com/wmfs/json-schema-builder/compare/v1.0.0...v1.1.0) (2019-01-16) 374 | 375 | 376 | ### ✨ Features 377 | 378 | * Add support for primaryKey properties ([51d51b3](https://github.com/wmfs/json-schema-builder/commit/51d51b3)) 379 | 380 | 381 | ### 🛠 Builds 382 | 383 | * Add lint script ([ec7b44b](https://github.com/wmfs/json-schema-builder/commit/ec7b44b)) 384 | 385 | 386 | ### 📚 Documentation 387 | 388 | * add codecov badge ([e25bd62](https://github.com/wmfs/json-schema-builder/commit/e25bd62)) 389 | 390 | 391 | ### 💎 Styles 392 | 393 | * Lint fix ([ab77c3f](https://github.com/wmfs/json-schema-builder/commit/ab77c3f)) 394 | 395 | # 1.0.0 (2019-01-07) 396 | 397 | 398 | ### ✨ Features 399 | 400 | * Add example/examples metadata support. ([0dd624f](https://github.com/wmfs/json-schema-builder/commit/0dd624f)) 401 | * Iniitial commit. ([6b5e314](https://github.com/wmfs/json-schema-builder/commit/6b5e314)) 402 | * Initial commit. ([89b5fae](https://github.com/wmfs/json-schema-builder/commit/89b5fae)) 403 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 West Midlands Fire Service 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # json-schema-builder 2 | 3 | [![Tymly Package](https://img.shields.io/badge/tymly-package-blue.svg)](https://tymly.io/) 4 | [![npm (scoped)](https://img.shields.io/npm/v/@wmfs/json-schema-builder.svg)](https://www.npmjs.com/package/@wmfs/json-schema-builder) 5 | [![CircleCI](https://circleci.com/gh/wmfs/json-schema-builder.svg?style=svg)](https://circleci.com/gh/wmfs/json-schema-builder) 6 | [![codecov](https://codecov.io/gh/wmfs/json-schema-builder/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/json-schema-builder) 7 | [![CodeFactor](https://www.codefactor.io/repository/github/wmfs/json-schema-builder/badge)](https://www.codefactor.io/repository/github/wmfs/json-schema-builder) 8 | [![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/) 9 | [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) 10 | [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) 11 | [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/json-schema-builder/blob/master/README.md) 12 | 13 | 14 | > Generate JSON-Schema schemas via a UI-orientated DSL. 15 | 16 | # Why? 17 | 18 | If you're building some high-level, user-facing tool to produce JSON Schema objects, chances are your internal representation will be more array-like... 19 | This package is intended to take that internal DSL and turn it into a valid JSON-Schema schema. 20 | 21 | * Here `typeHint` should be one of the [types supported by tymly-data-types](https://github.com/wmfs/tymly-data-types#reference). 22 | 23 | # Installation 24 | 25 | ``` bash 26 | npm install @wmfs/json-schema-builder --save 27 | ``` 28 | 29 | ## Usage 30 | 31 | ``` javascript 32 | 33 | const jsonSchemaBuilder = require('@wmfs/json-schema-builder') 34 | 35 | const jsonSchema = jsonSchemaBuilder.dslToJsonSchema( 36 | { 37 | title: 'Pizza', 38 | description: 'A model for storing details of a pizza (recipe, price etc.)', 39 | propertyHints: [ 40 | { 41 | key: 'code', 42 | typeHint: 'text', 43 | example: 'CHEESE_TOMATO', 44 | required: true, 45 | title: 'Unique code of the pizza', 46 | minLength: 3, 47 | maxLength: 15, 48 | primary: true 49 | }, 50 | { 51 | key: 'label', 52 | typeHint: 'text', 53 | required: true, 54 | example: 'Cheese & Tomato', 55 | title: 'Customer-facing label' 56 | }, 57 | { 58 | key: 'popularitySeq', 59 | typeHint: 'integer', 60 | required: true, 61 | title: 'Integer value to order lists by', 62 | minimum: 1 63 | }, 64 | { 65 | key: 'imageUri', 66 | typeHint: 'uri', 67 | required: true, 68 | example: 'https://tinyurl.com/y8r5bbu5', 69 | title: 'URI to an enticing photo of the pizza' 70 | }, 71 | { 72 | key: 'crusts', 73 | typeHint: 'text', 74 | choiceSet: { 75 | NORMAL: 'Normal', 76 | STUFFED: 'Stuffed', 77 | HOT_DOG: 'Hot Dog' 78 | }, 79 | multiple: true, 80 | default: ['NORMAL', 'STUFFED'], 81 | title: 'Offer which crust options?', 82 | required: true 83 | }, 84 | { 85 | key: 'vegetarian', 86 | typeHint: 'boolean', 87 | required: true, 88 | default: false, 89 | title: 'Is the pizza suitable for vegetarians?' 90 | }, 91 | { 92 | key: 'allergens', 93 | typeHint: 'text', 94 | example: ['Gluten', 'Wheat', 'Milk'], 95 | multiple: true, 96 | uniqueItems: true, 97 | title: 'List of allergens present in pizza' 98 | }, 99 | { 100 | key: 'availabilityEnd', 101 | typeHint: 'date', 102 | example: '2019-12-31', 103 | required: false, 104 | title: 'Date when pizza is no longer available.' 105 | }, 106 | { 107 | key: 'reviews', 108 | typeHint: 'object', 109 | multiple: true, 110 | title: 'Favourable customer reviews', 111 | propertyHints: [ 112 | { 113 | key: 'username', 114 | example: 'joebloggs4', 115 | typeHint: 'text', 116 | required: true, 117 | title: 'Who wrote the review' 118 | }, 119 | { 120 | key: 'review', 121 | example: 'Lovely stuff!', 122 | typeHint: 'text', 123 | required: true, 124 | title: 'Something nice to say' 125 | }, 126 | { 127 | key: 'rating', 128 | title: 'Star rating (0=Awful 5=Great)', 129 | example: 5, 130 | typeHint: 'integer', 131 | required: true, 132 | minimum: 0, 133 | maximum: 5, 134 | default: 5 135 | } 136 | ] 137 | } 138 | ] 139 | }) 140 | 141 | /* 142 | 143 | // Which returns... 144 | // ---------------- 145 | // 146 | 147 | { 148 | "$schema": "http://json-schema.org/draft-06/schema#", 149 | "title": "Pizza", 150 | "description": "A model for storing details of a pizza (recipe, price etc.)", 151 | "type": "object", 152 | "properties": { 153 | "code": { 154 | "type": "string", 155 | "title": "Unique code of the pizza", 156 | "examples": [ 157 | "CHEESE_TOMATO" 158 | ], 159 | "minLength": 3, 160 | "maxLength": 15 161 | }, 162 | "label": { 163 | "type": "string", 164 | "title": "Customer-facing label", 165 | "examples": [ 166 | "Cheese & Tomato" 167 | ] 168 | }, 169 | "popularitySeq": { 170 | "type": "integer", 171 | "title": "Integer value to order lists by", 172 | "minimum": 1 173 | }, 174 | "imageUri": { 175 | "type": "string", 176 | "format": "uri", 177 | "title": "URI to an enticing photo of the pizza", 178 | "examples": [ 179 | "https://tinyurl.com/y8r5bbu5" 180 | ] 181 | }, 182 | "crusts": { 183 | "type": "array", 184 | "title": "Offer which crust options?", 185 | "default": [ 186 | "NORMAL", 187 | "STUFFED" 188 | ], 189 | "items": { 190 | "type": "string", 191 | "enum": [ 192 | "NORMAL", 193 | "STUFFED", 194 | "HOT_DOG" 195 | ] 196 | } 197 | }, 198 | "vegetarian": { 199 | "type": "boolean", 200 | "title": "Is the pizza suitable for vegetarians?", 201 | "default": false 202 | }, 203 | "allergens": { 204 | "type": "array", 205 | "title": "List of allergens present in pizza", 206 | "examples": [ 207 | [ 208 | "Gluten", 209 | "Wheat", 210 | "Milk" 211 | ] 212 | ], 213 | "uniqueItems": true, 214 | "items": { 215 | "type": "string" 216 | } 217 | }, 218 | "availabilityEnd": { 219 | "type": "string", 220 | "format": "date-time", 221 | "title": "Date when pizza is no longer available.", 222 | "examples": [ 223 | "2019-12-31" 224 | ] 225 | }, 226 | "reviews": { 227 | "type": "array", 228 | "title": "Favourable customer reviews", 229 | "items": { 230 | "type": "object", 231 | "properties": { 232 | "username": { 233 | "type": "string", 234 | "title": "Who wrote the review", 235 | "examples": [ 236 | "joebloggs4" 237 | ] 238 | }, 239 | "review": { 240 | "type": "string", 241 | "title": "Something nice to say", 242 | "examples": [ 243 | "Lovely stuff!" 244 | ] 245 | }, 246 | "rating": { 247 | "type": "integer", 248 | "title": "Star rating (0=Awful 5=Great)", 249 | "default": 5, 250 | "examples": [ 251 | 5 252 | ], 253 | "minimum": 0, 254 | "maximum": 5 255 | } 256 | }, 257 | "required": [ 258 | "username", 259 | "review", 260 | "rating" 261 | ] 262 | } 263 | } 264 | }, 265 | "required": [ 266 | "code", 267 | "label", 268 | "popularitySeq", 269 | "imageUri", 270 | "crusts", 271 | "vegetarian" 272 | ], 273 | "primaryKey": [ 274 | "code" 275 | ] 276 | } 277 | 278 | */ 279 | 280 | ``` 281 | 282 | ## Testing 283 | 284 | ``` bash 285 | npm test 286 | ``` 287 | 288 | 289 | ## License 290 | [MIT](https://github.com/wmfs/json-schema-builder/blob/master/LICENSE) 291 | -------------------------------------------------------------------------------- /lib/add-properties.js: -------------------------------------------------------------------------------- 1 | const dataTypes = require('@wmfs/tymly-data-types') 2 | const makeBase = require('./utils/make-base') 3 | const categoryProcessors = require('./category-processors') 4 | const dottie = require('dottie') 5 | 6 | function addProperties (root, hints, section, page, pageFx, pageValidations) { 7 | if (!hints) { 8 | return 9 | } 10 | if (!root.properties) { 11 | root.properties = {} 12 | } 13 | if (section) { 14 | if (!root.properties[section]) { 15 | root.properties[section] = {} 16 | root.properties[section].title = section 17 | root.properties[section].typeHint = 'section' 18 | root.properties[section].properties = {} 19 | } 20 | if (!root.properties[section].properties[page]) { 21 | root.properties[section].properties[page] = {} 22 | root.properties[section].properties[page].title = page 23 | root.properties[section].properties[page].typeHint = 'page' 24 | root.properties[section].properties[page].properties = {} 25 | root.properties[section].properties[page].validations = pageValidations 26 | } 27 | for (const hint of hints) { 28 | if (pageFx) addProperty(root, hint, section, page, pageFx) 29 | else addProperty(root, hint, section, page) 30 | } 31 | } else if (page) { 32 | if (!root.properties[page]) { 33 | root.properties[page] = {} 34 | root.properties[page].title = page 35 | root.properties[page].typeHint = 'page' 36 | root.properties[page].properties = {} 37 | root.properties[page].validation = pageValidations 38 | } 39 | for (const hint of hints) { 40 | if (pageFx) addProperty(root, hint, undefined, page, pageFx) 41 | else addProperty(root, hint, undefined, page) 42 | } 43 | } else { 44 | for (const hint of hints) { 45 | addProperty(root, hint) 46 | } 47 | } 48 | 49 | const required = hints.filter(h => h.required).map(h => h.key) 50 | if (required.length > 0) { 51 | root.required = required 52 | } 53 | const primary = hints.filter(h => h.primary).map(h => h.key) 54 | if (primary.length > 0) { 55 | root.primaryKey = primary 56 | } 57 | } 58 | 59 | function addProperty (root, hint, section, page, pageFx) { 60 | const dataType = dataTypes.getDataTypeByName(hint.typeHint) 61 | let base 62 | // console.log(hint) 63 | let propPath 64 | if (section) { 65 | propPath = root.properties[section].properties[page].properties 66 | } else if (page) { 67 | propPath = root.properties[page].properties 68 | } else { 69 | propPath = root.properties 70 | } 71 | if (hint.typeHint === 'object') { 72 | base = makeBase(hint, { 73 | type: 'object' 74 | }) 75 | propPath[hint.key] = base.propertyValue 76 | let target = propPath[hint.key] 77 | if (target.items) { 78 | target = target.items 79 | } 80 | addProperties(target, hint.propertyHints, section, page) 81 | } else if (dataType) { 82 | base = makeBase(hint, JSON.parse(JSON.stringify(dataType.jsonSchema))) 83 | if (Object.prototype.hasOwnProperty.call(categoryProcessors, dataType.category)) { 84 | categoryProcessors[dataType.category](base.target, hint) 85 | } 86 | if (hint.tooltip) { 87 | base.propertyValue.tooltip = hint.tooltip 88 | base.target.tooltip = hint.tooltip 89 | } 90 | } else if (hint.typeHint === 'info') { 91 | base = { 92 | propertyValue: { 93 | typeHint: hint.typeHint, 94 | text: hint.text 95 | }, 96 | target: { 97 | typeHint: hint.typeHint, 98 | text: hint.text 99 | } 100 | } 101 | } else if (hint.typeHint === 'cardlist') { 102 | const propertiesName = Object.keys(hint.properties) 103 | base = { 104 | propertyValue: { 105 | key: hint.key, 106 | typeHint: 'object', 107 | title: hint.title, 108 | subtitle: hint.subtitle, 109 | properties: jsonSchemaBuilder(hint.properties[propertiesName]).properties 110 | }, 111 | target: { 112 | key: hint.key, 113 | typeHint: 'object', 114 | title: hint.title, 115 | subtitle: hint.subtitle, 116 | properties: jsonSchemaBuilder(hint.properties[propertiesName]).properties 117 | } 118 | } 119 | } else { 120 | console.log(hint) 121 | console.error(`Unknown type hint ${hint.typeHint}`) 122 | } 123 | // if (showWhen && showWhen.condition !== 'true') { 124 | // base.propertyValue.showWhen = showWhen.condition 125 | // base.target.showWhen = showWhen.condition 126 | // } 127 | if (pageFx) { 128 | pageFx.showWhens.forEach(showWhen => { 129 | if (showWhen.target === hint.key) { 130 | base.propertyValue.showWhen = showWhen.condition 131 | base.target.showWhen = showWhen.condition 132 | } 133 | }) 134 | pageFx.autoSetters.forEach(autoSetter => { 135 | if (autoSetter.target === hint.key) { 136 | base.propertyValue.autoSetter = autoSetter.condition 137 | base.propertyValue.autoValue = autoSetter.value 138 | base.target.autoSetter = autoSetter.condition 139 | base.target.autoValue = autoSetter.value 140 | } 141 | }) 142 | } 143 | // if (hint.key === 'humanFactors') console.log(base) 144 | propPath[hint.key] = base && base.propertyValue 145 | } // addProperty 146 | 147 | function jsonSchemaBuilder (options) { 148 | // console.log(options) 149 | const schema = {} 150 | if (options.pages) { 151 | Object.keys(options.pages).forEach(page => { 152 | const pageHints = dottie.get(options, `pages.${page}.propertyHints`) 153 | const pageFx = dottie.get(options, `pages.${page}.fx`) 154 | const pageValidations = dottie.get(options, `pages.${page}.validations`) 155 | addProperties(schema, pageHints, undefined, page, pageFx, pageValidations) 156 | }) 157 | } else { 158 | addProperties(schema, options.propertyHints) 159 | } 160 | return schema 161 | } 162 | 163 | module.exports = addProperties 164 | -------------------------------------------------------------------------------- /lib/category-processors/choice.js: -------------------------------------------------------------------------------- 1 | module.exports = function choiceCategoryProcessor (target, hint) { 2 | } 3 | -------------------------------------------------------------------------------- /lib/category-processors/date-time.js: -------------------------------------------------------------------------------- 1 | module.exports = function dateTimeCategoryProcessor (target, hint) { 2 | } 3 | -------------------------------------------------------------------------------- /lib/category-processors/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | choice: require('./choice'), 3 | dateTime: require('./date-time'), 4 | number: require('./number'), 5 | ref: require('./ref'), 6 | text: require('./text') 7 | } 8 | -------------------------------------------------------------------------------- /lib/category-processors/number.js: -------------------------------------------------------------------------------- 1 | const applyChoiceSetAsEnum = require('../utils/apply-choice-set-as-enum') 2 | const NUMERIC_ATTRIBUTE_KEYS = [ 3 | 'minimum', 4 | 'exclusiveMinimum', 5 | 'maximum', 6 | 'exclusiveMaximum', 7 | 'multipleOf' 8 | ] 9 | 10 | module.exports = function numberCategoryProcessor (target, hint) { 11 | NUMERIC_ATTRIBUTE_KEYS.forEach( 12 | (key) => { 13 | if (Object.prototype.hasOwnProperty.call(hint, key)) { 14 | target[key] = hint[key] 15 | } 16 | } 17 | ) 18 | applyChoiceSetAsEnum(target, hint) 19 | } 20 | -------------------------------------------------------------------------------- /lib/category-processors/ref.js: -------------------------------------------------------------------------------- 1 | module.exports = function refCategoryProcessor (target, hint) { 2 | } 3 | -------------------------------------------------------------------------------- /lib/category-processors/text.js: -------------------------------------------------------------------------------- 1 | const applyChoiceSetAsEnum = require('../utils/apply-choice-set-as-enum') 2 | const STRING_ATTRIBUTE_KEYS = [ 3 | 'minLength', 4 | 'maxLength', 5 | 'pattern' 6 | ] 7 | 8 | module.exports = function textCategoryProcessor (target, hint) { 9 | STRING_ATTRIBUTE_KEYS.forEach( 10 | (key) => { 11 | if (Object.prototype.hasOwnProperty.call(hint, key)) { 12 | target[key] = hint[key] 13 | } 14 | } 15 | ) 16 | applyChoiceSetAsEnum(target, hint) 17 | } 18 | -------------------------------------------------------------------------------- /lib/json-schema-builder.js: -------------------------------------------------------------------------------- 1 | const dataTypes = require('@wmfs/tymly-data-types') 2 | const applyMetaAttributes = require('./utils/apply-meta-attributes') 3 | const addProperties = require('./add-properties') 4 | const dottie = require('dottie') 5 | 6 | function jsonSchemaBuilder (options) { 7 | const schema = { 8 | $schema: 'http://json-schema.org/draft-06/schema#' 9 | } 10 | applyMetaAttributes(schema, options, {}) 11 | schema.type = 'object' 12 | if (options.sections) { 13 | Object.keys(options.sections).forEach(section => { 14 | const sectionTitle = dottie.get(options, `sections.${section}.title`) 15 | const sectionDescription = dottie.get(options, `sections.${section}.description`) 16 | let sectionHeader 17 | if (sectionTitle === sectionDescription) { 18 | sectionHeader = sectionTitle 19 | } else { 20 | sectionHeader = sectionTitle + ' - ' + sectionDescription 21 | } 22 | const sectionPages = dottie.get(options, `sections.${section}.pages`) 23 | Object.keys(sectionPages).forEach(page => { 24 | const pageHints = dottie.get(options, `sections.${section}.pages.${page}.propertyHints`) 25 | const pageFx = dottie.get(options, `sections.${section}.pages.${page}.fx`) 26 | const pageValidations = dottie.get(options, `sections.${section}.pages.${page}.validations`) 27 | addProperties(schema, pageHints, sectionHeader, page, pageFx, pageValidations) 28 | }) 29 | }) 30 | } else { 31 | addProperties(schema, options.propertyHints) 32 | } 33 | return schema 34 | } 35 | 36 | module.exports = { 37 | dslToJsonSchema: jsonSchemaBuilder, 38 | dataTypes: dataTypes 39 | } 40 | -------------------------------------------------------------------------------- /lib/utils/apply-choice-set-as-enum.js: -------------------------------------------------------------------------------- 1 | module.exports = function applyChoiceSetAsEnum (target, hint) { 2 | if (Object.prototype.hasOwnProperty.call(hint, 'choiceSet')) { 3 | target.enum = Object.keys(hint.choiceSet) 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /lib/utils/apply-meta-attributes.js: -------------------------------------------------------------------------------- 1 | const META_ATTRIBUTE_KEYS = [ 2 | 'title', 3 | 'description', 4 | 'default', 5 | 'examples' 6 | ] 7 | 8 | module.exports = function applyMetaAttributes (target, hint, dataItemDefaults) { 9 | Object.entries(dataItemDefaults).forEach(([key, value]) => { 10 | target[key] = value 11 | }) 12 | META_ATTRIBUTE_KEYS.forEach( 13 | (key) => { 14 | if (Object.prototype.hasOwnProperty.call(hint, key)) { 15 | target[key] = hint[key] 16 | } 17 | } 18 | ) 19 | if (Object.prototype.hasOwnProperty.call(hint, 'example') && !Object.prototype.hasOwnProperty.call(hint, 'examples')) { 20 | target.examples = [hint.example] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/utils/make-base.js: -------------------------------------------------------------------------------- 1 | const applyMetaAttributes = require('./apply-meta-attributes') 2 | 3 | module.exports = function makeBaseObject (hint, typeDefaults) { 4 | const base = { 5 | typeHint: hint.typeHint 6 | } 7 | applyMetaAttributes(base, hint, typeDefaults) 8 | 9 | let target 10 | if (hint.choiceSet) { 11 | base.items = {} 12 | base.items.type = typeof Object.values(hint.choiceSet)[0] 13 | base.items.enum = hint.choiceSet 14 | } 15 | if (hint.multiple) { 16 | // if (hint.key === 'humanFactors') console.log('MULTIPLE') 17 | base.type = 'array' 18 | if (Object.prototype.hasOwnProperty.call(hint, 'uniqueItems')) { 19 | base.uniqueItems = hint.uniqueItems 20 | } 21 | if (Object.prototype.hasOwnProperty.call(hint, 'minItems')) { 22 | base.minItems = hint.minItems 23 | } 24 | if (Object.prototype.hasOwnProperty.call(hint, 'maxItems')) { 25 | base.maxItems = hint.maxItems 26 | } 27 | if (hint.choiceSet) { 28 | base.items.type = typeof Object.values(hint.choiceSet)[0] 29 | base.items.enum = hint.choiceSet 30 | } else { 31 | base.items = typeDefaults 32 | } 33 | target = base.items 34 | } else { 35 | target = base 36 | } 37 | 38 | return { 39 | propertyValue: base, 40 | target: target 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@wmfs/json-schema-builder", 3 | "version": "0.0.0-semantically-released", 4 | "description": "Generate JSON-Schema schemas via a UI-orientated DSL.", 5 | "author": "West Midlands Fire Service", 6 | "homepage": "https://github.com/wmfs/json-schema-builder#readme", 7 | "keywords": [ 8 | "tymly", 9 | "package", 10 | "json schema" 11 | ], 12 | "license": "MIT", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/wmfs/json-schema-builder.git" 16 | }, 17 | "bugs": { 18 | "url": "https://github.com/wmfs/json-schema-builder/issues" 19 | }, 20 | "main": "lib/json-schema-builder.js", 21 | "directories": { 22 | "lib": "lib" 23 | }, 24 | "dependencies": { 25 | "@wmfs/tymly-data-types": "1.5.0", 26 | "lodash": "4.17.21", 27 | "dottie": "2.0.6", 28 | "mem-fs": "2.3.0", 29 | "mem-fs-editor": "9.7.0" 30 | }, 31 | "devDependencies": { 32 | "chai": "4.5.0", 33 | "codecov": "3.8.3", 34 | "conventional-changelog-conventionalcommits": "9.0.0", 35 | "cz-conventional-changelog": "3.3.0", 36 | "mocha": "11.5.0", 37 | "nyc": "17.1.0", 38 | "standard": "17.1.2", 39 | "semantic-release": "24.2.5", 40 | "@semantic-release/changelog": "6.0.3", 41 | "@semantic-release/release-notes-generator": "14.0.3", 42 | "@semantic-release/git": "10.0.1", 43 | "rimraf": "6.0.1" 44 | }, 45 | "scripts": { 46 | "test": "nyc mocha", 47 | "lint": "standard", 48 | "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", 49 | "semantic-release": "semantic-release" 50 | }, 51 | "config": { 52 | "commitizen": { 53 | "path": "cz-conventional-changelog" 54 | } 55 | }, 56 | "publishConfig": { 57 | "access": "public" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ], 5 | "dependencyDashboard": true, 6 | "enabledManagers": ["npm"], 7 | "packageRules": [ 8 | { 9 | "matchDepTypes": ["devDependencies"], 10 | "automerge": true, 11 | "semanticCommitType": "build", 12 | "semanticCommitScope": "deps-dev", 13 | "labels": ["devDependencies"] 14 | }, 15 | { 16 | "matchDepTypes": ["dependencies"], 17 | "semanticCommitType": "build", 18 | "semanticCommitScope": "deps", 19 | "labels": ["dependencies"], 20 | "reviewers": ["team:tymly-reviewers"] 21 | } 22 | ], 23 | "vulnerabilityAlerts": { 24 | "labels": ["security"] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/builder-spec.js: -------------------------------------------------------------------------------- 1 | /* eslint-env mocha */ 2 | 3 | const expect = require('chai').expect 4 | const jsonSchemaBuilder = require('../lib/json-schema-builder') 5 | 6 | describe('Basic builder tests', function () { 7 | this.timeout(process.env.TIMEOUT || 5000) 8 | 9 | it('Convert some basic stuff', () => { 10 | const jsonSchema = jsonSchemaBuilder.dslToJsonSchema( 11 | { 12 | title: 'Pizza', 13 | description: 'A model for storing details of a pizza (recipe, price etc.)', 14 | propertyHints: [ 15 | { 16 | key: 'code', 17 | typeHint: 'text', 18 | example: 'CHEESE_TOMATO', 19 | required: true, 20 | title: 'Unique code of the pizza', 21 | minLength: 3, 22 | maxLength: 15, 23 | primary: true 24 | }, 25 | { 26 | key: 'label', 27 | typeHint: 'text', 28 | required: true, 29 | example: 'Cheese & Tomato', 30 | title: 'Customer-facing label' 31 | }, 32 | { 33 | key: 'popularitySeq', 34 | typeHint: 'integer', 35 | required: true, 36 | title: 'Integer value to order lists by', 37 | minimum: 1 38 | }, 39 | { 40 | key: 'imageUri', 41 | typeHint: 'uri', 42 | required: true, 43 | example: 'https://tinyurl.com/y8r5bbu5', 44 | title: 'URI to an enticing photo of the pizza' 45 | }, 46 | { 47 | key: 'crusts', 48 | typeHint: 'text', 49 | choiceSet: { 50 | NORMAL: 'Normal', 51 | STUFFED: 'Stuffed', 52 | HOT_DOG: 'Hot Dog' 53 | }, 54 | multiple: true, 55 | default: ['NORMAL', 'STUFFED'], 56 | title: 'Offer which crust options?', 57 | required: true 58 | }, 59 | { 60 | key: 'vegetarian', 61 | typeHint: 'boolean', 62 | required: true, 63 | default: false, 64 | title: 'Is the pizza suitable for vegetarians?' 65 | }, 66 | { 67 | key: 'allergens', 68 | typeHint: 'text', 69 | example: ['Gluten', 'Wheat', 'Milk'], 70 | multiple: true, 71 | uniqueItems: true, 72 | title: 'List of allergens present in pizza' 73 | }, 74 | { 75 | key: 'availabilityEnd', 76 | typeHint: 'date', 77 | example: '2019-12-31', 78 | required: false, 79 | title: 'Date when pizza is no longer available.' 80 | }, 81 | { 82 | key: 'reviews', 83 | typeHint: 'object', 84 | multiple: true, 85 | title: 'Favourable customer reviews', 86 | propertyHints: [ 87 | { 88 | key: 'username', 89 | example: 'joebloggs4', 90 | typeHint: 'text', 91 | required: true, 92 | title: 'Who wrote the review' 93 | }, 94 | { 95 | key: 'review', 96 | example: 'Lovely stuff!', 97 | typeHint: 'text', 98 | required: true, 99 | title: 'Something nice to say' 100 | }, 101 | { 102 | key: 'rating', 103 | title: 'Star rating (0=Awful 5=Great)', 104 | example: 5, 105 | typeHint: 'integer', 106 | required: true, 107 | minimum: 0, 108 | maximum: 5, 109 | default: 5 110 | } 111 | ] 112 | } 113 | ] 114 | } 115 | ) 116 | // console.log(JSON.stringify(jsonSchema, null, 2)) 117 | 118 | expect(jsonSchema).to.eql( 119 | { 120 | $schema: 'http://json-schema.org/draft-06/schema#', 121 | title: 'Pizza', 122 | description: 'A model for storing details of a pizza (recipe, price etc.)', 123 | type: 'object', 124 | properties: { 125 | code: { 126 | title: 'Unique code of the pizza', 127 | examples: [ 128 | 'CHEESE_TOMATO' 129 | ], 130 | type: 'string', 131 | typeHint: 'text', 132 | minLength: 3, 133 | maxLength: 15 134 | }, 135 | label: { 136 | title: 'Customer-facing label', 137 | examples: [ 138 | 'Cheese & Tomato' 139 | ], 140 | type: 'string', 141 | typeHint: 'text' 142 | }, 143 | popularitySeq: { 144 | title: 'Integer value to order lists by', 145 | type: 'integer', 146 | typeHint: 'integer', 147 | minimum: 1 148 | }, 149 | imageUri: { 150 | title: 'URI to an enticing photo of the pizza', 151 | examples: [ 152 | 'https://tinyurl.com/y8r5bbu5' 153 | ], 154 | type: 'string', 155 | typeHint: 'uri', 156 | format: 'uri' 157 | }, 158 | vegetarian: { 159 | title: 'Is the pizza suitable for vegetarians?', 160 | default: false, 161 | type: 'boolean', 162 | typeHint: 'boolean' 163 | }, 164 | crusts: { 165 | title: 'Offer which crust options?', 166 | default: [ 167 | 'NORMAL', 168 | 'STUFFED' 169 | ], 170 | type: 'array', 171 | typeHint: 'text', 172 | items: { 173 | type: 'string', 174 | enum: [ 175 | 'NORMAL', 176 | 'STUFFED', 177 | 'HOT_DOG' 178 | ] 179 | } 180 | }, 181 | allergens: { 182 | title: 'List of allergens present in pizza', 183 | type: 'array', 184 | typeHint: 'text', 185 | examples: [ 186 | [ 187 | 'Gluten', 188 | 'Wheat', 189 | 'Milk' 190 | ] 191 | ], 192 | uniqueItems: true, 193 | items: { 194 | type: 'string' 195 | } 196 | }, 197 | availabilityEnd: { 198 | title: 'Date when pizza is no longer available.', 199 | type: 'string', 200 | typeHint: 'date', 201 | examples: [ 202 | '2019-12-31' 203 | ], 204 | format: 'date-time' 205 | }, 206 | reviews: { 207 | title: 'Favourable customer reviews', 208 | type: 'array', 209 | typeHint: 'object', 210 | items: { 211 | type: 'object', 212 | properties: { 213 | username: { 214 | title: 'Who wrote the review', 215 | type: 'string', 216 | typeHint: 'text', 217 | examples: [ 218 | 'joebloggs4' 219 | ] 220 | }, 221 | review: { 222 | title: 'Something nice to say', 223 | type: 'string', 224 | typeHint: 'text', 225 | examples: [ 226 | 'Lovely stuff!' 227 | ] 228 | }, 229 | rating: { 230 | title: 'Star rating (0=Awful 5=Great)', 231 | default: 5, 232 | examples: [ 233 | 5 234 | ], 235 | type: 'integer', 236 | typeHint: 'integer', 237 | minimum: 0, 238 | maximum: 5 239 | } 240 | }, 241 | required: [ 242 | 'username', 243 | 'review', 244 | 'rating' 245 | ] 246 | } 247 | } 248 | }, 249 | required: [ 250 | 'code', 251 | 'label', 252 | 'popularitySeq', 253 | 'imageUri', 254 | 'crusts', 255 | 'vegetarian' 256 | ], 257 | primaryKey: [ 258 | 'code' 259 | ] 260 | } 261 | ) 262 | }) 263 | }) 264 | -------------------------------------------------------------------------------- /test/w2c-test.js: -------------------------------------------------------------------------------- 1 | /* eslint-env mocha */ 2 | 3 | const fs = require('fs') 4 | const path = require('path') 5 | const memFs = require('mem-fs') 6 | const editor = require('mem-fs-editor') 7 | const expect = require('chai').expect 8 | const jsonSchemaBuilder = require('../lib/json-schema-builder') 9 | 10 | const readFile = function (path) { 11 | return new Promise((resolve, reject) => fs.readFile(path, 'utf8', (err, data) => { 12 | if (err) reject(err) 13 | else resolve(data) 14 | })) 15 | } 16 | 17 | const convert = function (json, callback) { 18 | const store = memFs.create() 19 | const virtualFs = editor.create(store) 20 | const jsonSchema = jsonSchemaBuilder.dslToJsonSchema(json) 21 | const outputPath = path.resolve(__dirname, 'output', 'irs-workbook.json') 22 | virtualFs.writeJSON(outputPath, jsonSchema) 23 | 24 | virtualFs.commit(err => { 25 | if (err) return callback(err) 26 | callback(null) 27 | }) 28 | } 29 | 30 | describe('Basic builder tests', function () { 31 | xit('Convert some basic stuff', async () => { 32 | const file = await readFile(path.resolve(__dirname, 'fixtures', 'irs-workbook.json')) 33 | const json = JSON.parse(file) 34 | convert(json, (err) => { 35 | expect(err).to.eql(null) 36 | }) 37 | }) 38 | }) 39 | --------------------------------------------------------------------------------