Skip to content

Commit

Permalink
Merge pull request #181 from adobe/v2-rewrite
Browse files Browse the repository at this point in the history
V2 rewrite
  • Loading branch information
trieloff authored Dec 16, 2019
2 parents ea07ce0 + 4dfe90c commit f307ee1
Show file tree
Hide file tree
Showing 352 changed files with 13,009 additions and 10,924 deletions.
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

0 comments on commit f307ee1

Please sign in to comment.