Skip to content

Commit

Permalink
feat: Allow custom attributes in properties
Browse files Browse the repository at this point in the history
Add description into README.md file and add the new property into the tests

re adobe#151
  • Loading branch information
Roman Kunz committed Jul 26, 2019
1 parent 1a6beb1 commit 24592d0
Show file tree
Hide file tree
Showing 86 changed files with 812 additions and 155 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ $ jsonschema2md -d examples/schemas -o examples/docs -v 04
$ jsonschema2md -d examples/schemas -o examples/docs -v 06
```

## Display costum Attributes in the property description
`jsonschema2md` display only the attributes of an propety which are defined by JSON Schema. If you want to display costum 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
```


## Using JSON Schema Markdown Tools from `npm`

You can conveniently use the JSON Schema Markdown Tools from `npm`. This makes it possible to set up a conversion toolchain for your JSON Schema project that is driven entirely by `npm`. To do so, first define the dependency by adding this to your `"devDependencies"` section of `package.json`
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
24 changes: 24 additions & 0 deletions examples/docs/complex.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Number in a range
- is optional
- type: complex
- defined in this schema
- version: 1.0.0
- testProperty: test

### and Type

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

### or Type

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

### refabstract Type

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

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

##### foo Type

Expand All @@ -124,6 +132,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 @@ -138,6 +148,8 @@ false
- is optional
- type: Simple
- defined in this schema
- version: 1.0.0
- testProperty: test

### reflist Type

Expand All @@ -154,6 +166,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 @@ -166,6 +180,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 @@ -181,6 +197,8 @@ All items must be of the type:

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

##### foo Type

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

### xor Type

Expand All @@ -221,6 +241,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 @@ -235,6 +257,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
6 changes: 6 additions & 0 deletions examples/docs/definitions.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ An `id` with an `@` in front of it. The `@` stands for "dot com"
- is **required**
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### @id Type

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

### id Type

Expand All @@ -81,6 +85,8 @@ An about ids. It is meta. If you are confused, send an email to the address spec
- is optional
- type: `string`
- defined in this schema
- version: 1.0.0
- testProperty: test

### meta:id Type

Expand Down
Loading

0 comments on commit 24592d0

Please sign in to comment.