Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 rewrite #181

Merged
merged 113 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
351c865
refactor(cli): replace Optimist with yargs
trieloff Dec 2, 2019
a5c86af
build(package): npm audit fix
trieloff Dec 2, 2019
b6b1822
refactor(cli): remove bluebird, lodash, simplify arg parsing
trieloff Dec 2, 2019
1e7c0bc
refactor(schema): use ferrum for schema traversal
trieloff Dec 2, 2019
6db9aee
refactor(wip): more schema traversal
trieloff Dec 2, 2019
50d037b
refactor(schema): generate a map of all schemas
trieloff Dec 3, 2019
37c1d40
refactor(schema): filter out refs
trieloff Dec 3, 2019
e521541
feat(markdown): create and write markdown
trieloff Dec 3, 2019
87e8489
feat(markdown): list nested schemas in README
trieloff Dec 3, 2019
608674b
feat(markdown): list nested schemas in README
trieloff Dec 3, 2019
4df92e6
feat(markdown): add YAML frontmatter support
trieloff Dec 3, 2019
6225b9f
feat(markdown): add header surpression
trieloff Dec 3, 2019
90a9a8e
feat(markdown): show extensibility and abstraction in header
trieloff Dec 3, 2019
08e1923
feat(markdown): show id and status in header
trieloff Dec 4, 2019
b6fcf53
feat(markdown): show id and status in header
trieloff Dec 4, 2019
eff129a
feat(markdown): show type, link, additional and custom properties in …
trieloff Dec 5, 2019
f8a32df
feat(markdown): show some info about properties, switch i18n library
trieloff Dec 5, 2019
1b30584
refactor(wip): add a JSON Schema proxy for easier understanding of sc…
trieloff Dec 5, 2019
4cea068
feat(proxy): resolve references
trieloff Dec 5, 2019
eacbf38
feat(proxy): generate slugs
trieloff Dec 6, 2019
ac65ac6
feat(proxy): generate meta information
trieloff Dec 6, 2019
0fc5692
style(all): clean up some linting errors
trieloff Dec 6, 2019
2186142
fix(schemas): remove references going nowhere
trieloff Dec 6, 2019
616a1d9
fix(proxy): remove logging statements
trieloff Dec 6, 2019
6c74861
test(proxy): more proxy tests
trieloff Dec 9, 2019
d6b9e5e
feat(readme): generate readme again
trieloff Dec 9, 2019
011427c
feat(markdown): generate header again
trieloff Dec 9, 2019
fa34cf1
feat(markdown): generate some property details
trieloff Dec 9, 2019
c9f19e1
feat(markdown): generate type details
trieloff Dec 10, 2019
cc07df2
feat(markdown): generate additional detail
trieloff Dec 10, 2019
c8e8dfa
feat(markdown): show examples
trieloff Dec 10, 2019
515969c
feat(markdown): show value constraints
trieloff Dec 10, 2019
12af018
feat(markdown): show join types
trieloff Dec 10, 2019
6d18c25
style(all): eslint fixes
trieloff Dec 10, 2019
460a6c7
refactor(all): remove unused code
trieloff Dec 10, 2019
5f1509c
refactor(all): remove unused code
trieloff Dec 10, 2019
8e53cf8
style(all): eslint fixes
trieloff Dec 10, 2019
683af6c
style(markdown): fix eslint issues
trieloff Dec 10, 2019
b953c83
refactor(all): remove dead code
trieloff Dec 10, 2019
ae2e635
style(markdown): fix eslint issues
trieloff Dec 10, 2019
7ccec9e
refactor(all): remove dead code
trieloff Dec 10, 2019
1d5033c
refactor(all): remove dead code
trieloff Dec 10, 2019
aae8a92
style(markdown): fix eslint issues
trieloff Dec 10, 2019
ff0c9eb
style(markdown): fix eslint issues
trieloff Dec 10, 2019
143df80
style(markdown): fix eslint issues
trieloff Dec 10, 2019
1eaedfe
style(markdown): fix eslint issues
trieloff Dec 10, 2019
cfefa92
test(all): replace jasmine with mocha
trieloff Dec 11, 2019
dbc9192
build(dependencies): remove unused dependencies
trieloff Dec 11, 2019
4a37164
ci(circleci): replace jasmine with mocha
trieloff Dec 11, 2019
ba4a947
ci(test): require node 10
trieloff Dec 11, 2019
ba61b79
ci(coverage): report coverage even when threshold not reached
trieloff Dec 11, 2019
5be1b94
ci(coverage): install codecov dev dependency
trieloff Dec 11, 2019
04f7265
build(dependencies): update helix-log
trieloff Dec 11, 2019
d786c34
build(dependencies): update helix-log to v4
trieloff Dec 11, 2019
c6fbe81
docs(schema): list all keywords supported (and not supported)
trieloff Dec 11, 2019
d35e4ed
feat(markdown): highlight keyword usage for documentation
trieloff Dec 11, 2019
1386ee3
feat(markdown): support patternProperties and additionalProperties
trieloff Dec 11, 2019
c9fbcdf
feat(markdown): support item arrays and additionalItems
trieloff Dec 11, 2019
3a45c6a
refactor(cli): run readme and markdown generation in parallel, load s…
trieloff Dec 11, 2019
dd18f3b
feat(cli): generate JSON schema output
trieloff Dec 11, 2019
1a664de
feat(i18n): new internationalization system
trieloff Dec 11, 2019
8b53b68
Translate de.json via GitLocalize
trieloff Dec 11, 2019
bbeaeff
Merge pull request #182 from adobe/gitlocalize-10128
trieloff Dec 11, 2019
43a74f4
fix(i18n): use correct file name format
trieloff Dec 11, 2019
5eb0c89
feat(i18n): provide complete en_US translation
trieloff Dec 11, 2019
3837378
Translate de.json via GitLocalize
trieloff Dec 11, 2019
e8cfd81
Translate de.json via GitLocalize
mt-gitlocalize Dec 11, 2019
514ea5e
Merge pull request #183 from adobe/gitlocalize-10129
trieloff Dec 11, 2019
713f375
refactor(keywords): highlight keyword usage in code
trieloff Dec 12, 2019
22a9b47
Merge branch 'v2-rewrite' of github.com:adobe/jsonschema2md into v2-r…
trieloff Dec 12, 2019
bf98d0c
test(readme): add unit test for readme generation
trieloff Dec 12, 2019
d987d90
test(readme): add a more complex readme test
trieloff Dec 12, 2019
b4f8c78
test(schema): add simple schema tests
trieloff Dec 13, 2019
c8599d1
test(schema): add tests for string formats
trieloff Dec 13, 2019
cf6ba32
test(schema): add test for some array properties
trieloff Dec 13, 2019
6f3c83c
refactor(markdown): track usage of maxItems keyword
trieloff Dec 13, 2019
9d2aed2
refactor(formatname): remove dead code
trieloff Dec 13, 2019
45e2f5a
test(schema): add test for identifiable property
trieloff Dec 13, 2019
cbe6402
test(schema): test type detection
trieloff Dec 13, 2019
d9f6d52
refactor(format): remove dead code
trieloff Dec 13, 2019
170e829
refactor(format): remove dead code
trieloff Dec 13, 2019
f4a4614
refactor(format): remove dead code
trieloff Dec 13, 2019
b3b3469
refactor(proxy): remove dead code
trieloff Dec 13, 2019
f427471
test(proxy): test example loading
trieloff Dec 13, 2019
9502458
test(proxy): test dead references
trieloff Dec 13, 2019
ec19a1b
test(markdown): test header link injection
trieloff Dec 14, 2019
328d201
test(schema): test additionalProperties=true
trieloff Dec 14, 2019
8f57064
test(schema): add test for maximumProps minProps
trieloff Dec 14, 2019
8925ebb
test(markdown): more array tests
trieloff Dec 14, 2019
1c11bcb
test(schema): add exclusiveMinumum test
trieloff Dec 14, 2019
2e057fd
fix(markdown): constraint values can be zero now
trieloff Dec 14, 2019
e652e11
fix(markdown): handle null as a constant value
trieloff Dec 14, 2019
abeb91f
test(markdown): test enums
trieloff Dec 14, 2019
d5dfd7a
test(schema): testing support for not
trieloff Dec 16, 2019
714fa6c
test(schemas): test additionalItems=true
trieloff Dec 16, 2019
8e08476
refactor(markdown): increase test coverage
trieloff Dec 16, 2019
e06f533
refactor(markdown): remove dead code
trieloff Dec 16, 2019
214fdb4
Merge remote-tracking branch 'origin/master' into v2-rewrite
trieloff Dec 16, 2019
689c158
feat(formats): add support for formats: json-pointer, relative-json-p…
trieloff Dec 16, 2019
96ca3a6
feat(schema): add full support for "A Vocabulary for the Contents of …
trieloff Dec 16, 2019
72a0fde
feat(markdown): add support for `default` keyword
trieloff Dec 16, 2019
934b856
feat(schema): add support for keyword `deprecated`
trieloff Dec 16, 2019
7452882
feat(schema): add support for readOnly and writeOnly schemas and prop…
trieloff Dec 16, 2019
07bb52f
feat(markdown): add support for comments
trieloff Dec 16, 2019
0982f31
refactor(schema): track keyword `$ref`
trieloff Dec 16, 2019
70b63c8
feat(schema): add support for keyword `$defs`
trieloff Dec 16, 2019
fc583d7
feat(readme): mention the most common schema version
trieloff Dec 16, 2019
d314253
refactor(i18n): flag i18n-able strings in readme builder
trieloff Dec 16, 2019
ffb2a50
build(i18n): add script for automated string extraction
trieloff Dec 16, 2019
a5c6024
docs(examples): re-generate examples
trieloff Dec 16, 2019
fed471b
test(spec): remove old tests
trieloff Dec 16, 2019
440da45
docs(readme): prepare 4.0 release
trieloff Dec 16, 2019
4dfe90c
docs(changelog): mention changes for v4
trieloff Dec 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:8
- image: circleci/node:10

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand All @@ -26,15 +26,15 @@ jobs:
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install && npm i jasmine-xml-reporter
- run: npm install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: ./node_modules/jasmine-xml-reporter/bin/jasmine.js --junitreport --output=junit
- run: npm run test-ci

- store_test_results:
path: junit
Expand All @@ -44,7 +44,7 @@ jobs:
publish:
docker:
# specify the version you desire here
- image: circleci/node:8
- image: circleci/node:10

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand All @@ -65,7 +65,7 @@ jobs:

- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc

- run: npm install && npm i jasmine-xml-reporter
- run: npm install

- save_cache:
paths:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
out/
junit

# ide files
.project
Expand Down Expand Up @@ -29,3 +30,4 @@ npm-debug.log
# instanbul code coverage…
coverage
/examples/tmp-docs
.nyc_output
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@

---

# Note about Version 4.0

`jsonschema2md` v4.0.0 has been a major rewrite that changes output format, command line parameters, i18n templates in order to increase the [coverage of the JSON Schema specification](schemasupport.md) and to make the project more maintainable.

The JSON Schema validation functionality has been dropped entirely, as it is easier to just use `ajv` for that directly.

---

## [3.3.1](https://github.com/adobe/jsonschema2md/compare/v3.3.0...v3.3.1) (2019-09-18)


Expand Down
44 changes: 16 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# JSON Schema Markdown Tools

[![CircleCI](https://circleci.com/gh/adobe/jsonschema2md.svg?style=svg)](https://circleci.com/gh/adobe/jsonschema2md) [![Greenkeeper badge](https://badges.greenkeeper.io/adobe/jsonschema2md.svg)](https://greenkeeper.io/)
[![CircleCI](https://circleci.com/gh/adobe/jsonschema2md.svg?style=svg)](https://circleci.com/gh/adobe/jsonschema2md)

Documenting and validating complex JSON Schemas can be hard. This tool makes it easier by providing a number of scripts that can turn JSON Schema files into readable Markdown documentation that is ready for consumption on GitHub or processed using Jekyll or other static site generators.

These tools have been introduced by Adobe to document Adobe's Experience Data Models (XDM), but can be used for other JSON Schema documents, too.

## JSON Schema Support

`jsonschema2md` is developed against JSON Schema `2019-09`, but not the full vocabulary is supported. Please check the [detailed list of JSON Schema keywords supported by `jsonschema2md`](schemasupport.md). This list is updated by our tests.

## Requirements

- `npm` version 3.10.8 or up
- `node` v8 or up
- `node` v10 or up

## Example Output

Expand All @@ -18,39 +22,25 @@ Using the schemas in [`examples/schemas`](examples/schemas), the output in [`exa
## Installing and running

```bash
# clone this project
$ npm install -g @adobe/jsonschema2md

# show usage information
$ jsonschema2md

# run task
# leave out the -v "06", when you have draft-07 schemas
$ jsonschema2md -d examples/schemas -o examples/docs -v "06"
$ jsonschema2md -d examples/schemas -o examples/docs
# generated output for whole folder is written to ./examples/docs
```

## JSON Schema Draft Versions

`jsonschema2md` assumes `draft-07` by default. If your schemas are not on `draft-07`, you can specify the draft version using the `-v` or `--draft` flag.

```bash
# run against JSON Schema Draft 04
$ jsonschema2md -d examples/schemas -o examples/docs -v 04
```
## Internationalization

```bash
# run against JSON Schema Draft 06
$ jsonschema2md -d examples/schemas -o examples/docs -v 06
```
The generated documentation can be internationalized. Select the language you want to use for the output using the `-l` parameter.

## Text in Templates
Each text which is not provided by the JSON Schema is loaded from an i18n file. With i18n parameter you can change the location of the i18n folder and load your own text file. The folder must contain an locales folder and in this folder there should be an en.json file.
Supported languages are:
- English
- German

```bash
# run against JSON Schema Draft 06
$ jsonschema2md -d examples/schemas -o examples/docs -v 06 -i temp/myFiles
```
If you want to provide a translation of your own, [please use GitLocalize](https://gitlocalize.com/repo/3622)

## Display custom attributes in the property description
`jsonschema2md` displays only the attributes of an property which are defined by the JSON Schema standard. If you want to display additional attributes in the property description you could provide a comma separated list with your custom attributes.
Expand All @@ -73,7 +63,7 @@ You can conveniently use the JSON Schema Markdown Tools from `npm`. This makes i

```json
"devDependencies": {
"@adobe/jsonschema2md": "^1.0.6"
"@adobe/jsonschema2md": "^4.0.0"
}
```

Expand Down Expand Up @@ -104,7 +94,7 @@ All pull requests automatically trigger a job that runs the [tests](#tests) by e

### Code Coverage

You can run `npm run cover` to get a code coverage report, that is, a sense of how much of the project's code is "covered" by the test suite.
`npm run test` will generate a code coverage report at the end of the test run. Anything below 100% coverage counts as a test failure.

## Style Guide / Linting

Expand All @@ -116,9 +106,7 @@ npm run lint

## TODOs

* JSON Schema validation:
* property naming convention
* vocabulary spellchecking
Add support for [missing keywords](schemasupport.md)

## Contributing

Expand Down
Loading