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

Allow to display custom Attributes in the Properties description #152

Merged
merged 15 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ Each text which is not provided by the JSON Schema is loaded from an i18n file.
$ jsonschema2md -d examples/schemas -o examples/docs -v 06 -i temp/myFiles
```

## 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.


```bash
$ jsonschema2md -d examples/schemas -o examples/docs -p version,test
```

## Disable header template
In some cases you do not need a header because it does not provide any useful information. With the `--header` (or `-h`) parameter you can disable the inclusion of headers.
Expand Down
2 changes: 2 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const { argv } = Optimist
})
.alias('i', 'i18n')
.describe('i', 'path to a locales folder with an en.json file in it. This file will be used for all text parts in all templates')
.alias('p', 'properties')
.describe('p', 'A comma separated list with custom properties which should be also in the description of an element.')
.alias('h', 'header')
.describe('h', 'if the value is false the header will be skipped')
.default('h', true);
Expand Down
6 changes: 6 additions & 0 deletions examples/docs/abstract.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ A unique identifier given to every addressable thing.
- is optional
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### bar Type

Expand All @@ -46,6 +48,8 @@ A unique identifier given to every addressable thing.
- is optional
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### foo Type

Expand All @@ -60,6 +64,8 @@ This is not foo.
- is optional
- type: `const`
- defined in this schema
- version: 1.0.0
- testProperty: test

The value of this property **must** be equal to:

Expand Down
26 changes: 26 additions & 0 deletions examples/docs/arrays.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ An array of simple objects
- is optional
- type: `array`
- defined in this schema
- version: 1.0.0
- testProperty: test

### JoinTypelist Type

Expand All @@ -64,6 +66,8 @@ A simple string.

- is optional
- type: `string`
- version: 1.0.0
- testProperty: test

##### foo Type

Expand Down Expand Up @@ -91,6 +95,8 @@ A simple string.

- is optional
- type: `string`
- version: 1.0.0
- testProperty: test

##### bar Type

Expand All @@ -112,6 +118,8 @@ This is an array
- type: `boolean[]`
- at least `1` items in the array
- defined in this schema
- version: 1.0.0
- testProperty: test

### boollist Type

Expand All @@ -129,6 +137,8 @@ This is an array of coordinates in three-dimensional space.
- type: `number[][]` (nested array)
- no more than `10` items in the array
- defined in this schema
- version: 1.0.0
- testProperty: test

### coordinatelist Type

Expand All @@ -151,6 +161,8 @@ This is an array
- type: `integer[]`
- between `1` and `10` items in the array
- defined in this schema
- version: 1.0.0
- testProperty: test

### intlist Type

Expand All @@ -167,6 +179,8 @@ This is an array
- is optional
- type: `string[]`
- defined in this schema
- version: 1.0.0
- testProperty: test

### list Type

Expand All @@ -183,6 +197,8 @@ This is an array of arrays
- is optional
- type: `array[]` (nested array)
- defined in this schema
- version: 1.0.0
- testProperty: test

### listlist Type

Expand All @@ -198,6 +214,8 @@ This is an array
- type: `number[]`
- no more than `10` items in the array
- defined in this schema
- version: 1.0.0
- testProperty: test

### numlist Type

Expand All @@ -216,6 +234,8 @@ An array of simple objects
- is optional
- type: `object[]`
- defined in this schema
- version: 1.0.0
- testProperty: test

### objectlist Type

Expand All @@ -236,6 +256,8 @@ The a property

- is **required**
- type: `string`
- version: 1.0.0
- testProperty: test

##### a Type

Expand All @@ -249,6 +271,8 @@ The b property

- is optional
- type: `integer`
- version: 1.0.0
- testProperty: test

##### b Type

Expand All @@ -263,6 +287,8 @@ This is an array of arrays of strings
- is optional
- type: `string[][]` (nested array)
- defined in this schema
- version: 1.0.0
- testProperty: test

### stringlistlist Type

Expand Down
30 changes: 30 additions & 0 deletions examples/docs/complex.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Number in a range
- is optional
- type: complex
- defined in this schema
- version: 1.0.0
- testProperty: test

### and Type

Expand All @@ -72,6 +74,8 @@ String or number…
- is optional
- type: complex
- defined in this schema
- version: 1.0.0
- testProperty: test

### or Type

Expand All @@ -94,6 +98,8 @@ String or number…
- is **required**
- type: `object`
- defined in this schema
- version: 1.0.0
- testProperty: test

### refabstract Type

Expand All @@ -112,6 +118,8 @@ A unique identifier given to every addressable thing.

- is optional
- type: `string`
- version: 1.0.0
- testProperty: test

##### foo Type

Expand All @@ -125,6 +133,8 @@ This is not foo.

- is optional
- type: `const`
- version: 1.0.0
- testProperty: test

The value of this property **must** be equal to:

Expand All @@ -139,6 +149,8 @@ false
- is optional
- type: Simple
- defined in this schema
- version: 1.0.0
- testProperty: test

### reflist Type

Expand All @@ -155,6 +167,8 @@ All items must be of the type:
- is optional
- type: Simple
- defined in this schema
- version: 1.0.0
- testProperty: test

### refnamed Type

Expand All @@ -167,6 +181,8 @@ All items must be of the type:
- is optional
- type: `object`
- defined in this schema
- version: 1.0.0
- testProperty: test

### refnestedobj Type

Expand All @@ -182,6 +198,8 @@ All items must be of the type:

- is optional
- type: `object`
- version: 1.0.0
- testProperty: test

##### refobj Type

Expand All @@ -197,6 +215,8 @@ All items must be of the type:

- is optional
- type: Simple
- version: 1.0.0
- testProperty: test

##### foo Type

Expand All @@ -209,6 +229,8 @@ All items must be of the type:
- is optional
- type: `object`
- defined in this schema
- version: 1.0.0
- testProperty: test

### refobj Type

Expand All @@ -224,6 +246,8 @@ All items must be of the type:

- is optional
- type: Simple
- version: 1.0.0
- testProperty: test

##### foo Type

Expand All @@ -238,6 +262,8 @@ Exclusive choice.
- is optional
- type: complex
- defined in this schema
- version: 1.0.0
- testProperty: test

### xor Type

Expand All @@ -264,6 +290,8 @@ Applies to all properties that match the regular expression `int.*`
- is a property pattern
- type: `integer`
- defined in this schema
- version: 1.0.0
- testProperty: test

### Pattern int.\* Type

Expand All @@ -278,6 +306,8 @@ Applies to all properties that match the regular expression `str.*`
- is a property pattern
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### Pattern str.\* Type

Expand Down
2 changes: 2 additions & 0 deletions examples/docs/constants.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ A simple string, without strong constraints.
- is **required**
- type: `const`
- defined in this schema
- version: 1.0.0
- testProperty: test

The value of this property **must** be equal to:

Expand Down
4 changes: 4 additions & 0 deletions examples/docs/custom.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ A unique identifier given to every addressable thing.
- is optional
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### bar Type

Expand All @@ -47,6 +49,8 @@ A unique identifier given to every addressable thing.
- is optional
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### foo Type

Expand Down
12 changes: 12 additions & 0 deletions examples/docs/deepextending.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ An `id` with an `@` in front of it. The `@` stands for "dot com"
- is optional
- type: `string`
- defined in [Definitions](definitions.schema.md#id)
- version: 1.0.0
- testProperty: test

### @id Type

Expand All @@ -59,6 +61,8 @@ A horse walks into it.
- is optional
- type: `string`
- defined in [Extensible](extensible.schema.md#bar)
- version: 1.0.0
- testProperty: test

### bar Type

Expand All @@ -85,6 +89,8 @@ This property has a unique name to demonstrate it's uniqueness.
- is optional
- type: `string`
- defined in [Extending](extending.schema.md#baz)
- version: 1.0.0
- testProperty: test

### baz Type

Expand All @@ -105,6 +111,8 @@ A unique identifier given to every addressable thing.
- is optional
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### hey Type

Expand All @@ -119,6 +127,8 @@ A unique identifier given to every addressable thing.
- is optional
- type: `string`
- defined in [Definitions](definitions.schema.md#id-1)
- version: 1.0.0
- testProperty: test

### id Type

Expand All @@ -135,6 +145,8 @@ An about ids. It is meta. If you are confused, send an email to the address spec
- is optional
- type: `string`
- defined in [Definitions](definitions.schema.md#metaid)
- version: 1.0.0
- testProperty: test

### meta:id Type

Expand Down
Loading