Skip to content

Commit

Permalink
"[Deprecated" can now be anywhere in description
Browse files Browse the repository at this point in the history
Fixes #138
  • Loading branch information
dblanchette committed May 19, 2022
1 parent fb23eb1 commit de54b27
Show file tree
Hide file tree
Showing 15 changed files with 327 additions and 53 deletions.
6 changes: 6 additions & 0 deletions docs/examples/cases/deprecated.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"deprecated2": {
"description": "[Deprecated - Use `not_deprecated` instead]"
},
"deprecated3": {
"description": "This is [Deprecated]"
},
"deprecated4": {
"description": "This is [Deprecated - Use `not_deprecated` instead]"
},
"not_deprecated": {
"type": "string"
}
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/examples_flat_default/Configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ <h2 class="mb-0">
<div class="card">
<div class="card-header" id="deprecated_from_description">
<h2 class="mb-0">
<a href="#deprecated_from_description"><span class="property-name">deprecated_from_description</span></a></h2>
<a href="#deprecated_from_description"><span class="property-name">deprecated_from_description</span></a> <span class="badge badge-danger deprecated-property">Deprecated</span></h2>
</div>

<div class="card-body property-definition-div">
Expand Down
76 changes: 76 additions & 0 deletions docs/examples/examples_flat_default/deprecated.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,82 @@ <h2 class="mb-0">



</div>
</div>

<div class="card">
<div class="card-header" id="deprecated3">
<h2 class="mb-0">
<a href="#deprecated3"><span class="property-name">deprecated3</span></a> <span class="badge badge-danger deprecated-property">Deprecated</span></h2>
</div>

<div class="card-body property-definition-div">

<div class="breadcrumbs">root
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-right-short" fill="currentColor" xmlns="https://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
d="M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8z"
/>
</svg>
<a href="#deprecated3">deprecated3</a></div><span class="badge badge-dark value-type">Type: object</span><br/>







<p>This is [Deprecated]</p>











</div>
</div>

<div class="card">
<div class="card-header" id="deprecated4">
<h2 class="mb-0">
<a href="#deprecated4"><span class="property-name">deprecated4</span></a> <span class="badge badge-danger deprecated-property">Deprecated</span></h2>
</div>

<div class="card-body property-definition-div">

<div class="breadcrumbs">root
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-right-short" fill="currentColor" xmlns="https://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
d="M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8z"
/>
</svg>
<a href="#deprecated4">deprecated4</a></div><span class="badge badge-dark value-type">Type: object</span><br/>







<p>This is [Deprecated - Use <code>not_deprecated</code> instead]</p>











</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/examples_js_default/Configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ <h2 class="mb-0">
<div class="card-header" id="headingdeprecated_from_description">
<h2 class="mb-0">
<button class="btn btn-link property-name-button" type="button" data-toggle="collapse" data-target="#deprecated_from_description"
aria-expanded="" aria-controls="deprecated_from_description" onclick="setAnchor('#deprecated_from_description')"><span class="property-name">deprecated_from_description</span></button>
aria-expanded="" aria-controls="deprecated_from_description" onclick="setAnchor('#deprecated_from_description')"><span class="property-name">deprecated_from_description</span> <span class="badge badge-danger deprecated-property">Deprecated</span></button>
</h2>
</div>

Expand Down
68 changes: 68 additions & 0 deletions docs/examples/examples_js_default/deprecated.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,74 @@ <h2 class="mb-0">



</div>
</div>
</div>
</div>
<div class="accordion" id="accordiondeprecated3">
<div class="card">
<div class="card-header" id="headingdeprecated3">
<h2 class="mb-0">
<button class="btn btn-link property-name-button" type="button" data-toggle="collapse" data-target="#deprecated3"
aria-expanded="" aria-controls="deprecated3" onclick="setAnchor('#deprecated3')"><span class="property-name">deprecated3</span> <span class="badge badge-danger deprecated-property">Deprecated</span></button>
</h2>
</div>

<div id="deprecated3"
class="collapse property-definition-div" aria-labelledby="headingdeprecated3"
data-parent="#accordiondeprecated3">
<div class="card-body pl-5">

<div class="breadcrumbs">root
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-right-short" fill="currentColor" xmlns="https://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
d="M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8z"
/>
</svg>
<a href="#deprecated3" onclick="anchorLink('deprecated3')">deprecated3</a></div><span class="badge badge-dark value-type">Type: object</span><br/>
<span class="description"><p>This is [Deprecated]</p>
</span>






</div>
</div>
</div>
</div>
<div class="accordion" id="accordiondeprecated4">
<div class="card">
<div class="card-header" id="headingdeprecated4">
<h2 class="mb-0">
<button class="btn btn-link property-name-button" type="button" data-toggle="collapse" data-target="#deprecated4"
aria-expanded="" aria-controls="deprecated4" onclick="setAnchor('#deprecated4')"><span class="property-name">deprecated4</span> <span class="badge badge-danger deprecated-property">Deprecated</span></button>
</h2>
</div>

<div id="deprecated4"
class="collapse property-definition-div" aria-labelledby="headingdeprecated4"
data-parent="#accordiondeprecated4">
<div class="card-body pl-5">

<div class="breadcrumbs">root
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-right-short" fill="currentColor" xmlns="https://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
d="M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8z"
/>
</svg>
<a href="#deprecated4" onclick="anchorLink('deprecated4')">deprecated4</a></div><span class="badge badge-dark value-type">Type: object</span><br/>
<span class="description"><p>This is [Deprecated - Use <code>not_deprecated</code> instead]</p>
</span>






</div>
</div>
</div>
Expand Down
15 changes: 8 additions & 7 deletions docs/examples/examples_md_default/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- [5. [Optional] Property `JSON Schema for Humans configuration file > collapse_long_descriptions`](#collapse_long_descriptions)
- [6. [Optional] Property `JSON Schema for Humans configuration file > link_to_reused_ref`](#link_to_reused_ref)
- [7. [Optional] Property `JSON Schema for Humans configuration file > recursive_detection_depth`](#recursive_detection_depth)
- [8. [Optional] Property `JSON Schema for Humans configuration file > deprecated_from_description`](#deprecated_from_description)
- [8. [Optional]~~ Property `JSON Schema for Humans configuration file > deprecated_from_description`~~](#deprecated_from_description)
- [9. [Optional] Property `JSON Schema for Humans configuration file > default_from_description`](#default_from_description)
- [10. [Optional] Property `JSON Schema for Humans configuration file > copy_css`](#copy_css)
- [11. [Optional] Property `JSON Schema for Humans configuration file > copy_js`](#copy_js)
Expand Down Expand Up @@ -48,7 +48,7 @@ Configuration parameters can be provided in several ways:
| - [collapse_long_descriptions](#collapse_long_descriptions ) | No | boolean | No | - | If a description is considered big, show only the beginning and add a 'Read more ... |
| - [link_to_reused_ref](#link_to_reused_ref ) | No | boolean | No | - | If several '$ref' points to the same definition, only render the documentation f ... |
| - [recursive_detection_depth](#recursive_detection_depth ) | No | integer | No | - | *Advanced option* ... |
| - [deprecated_from_description](#deprecated_from_description ) | No | boolean | No | - | Mark a property as deprecated (with a big red badge) if the description contains ... |
| - [deprecated_from_description](#deprecated_from_description ) | No | boolean | [Deprecated] | - | Mark a property as deprecated (with a big red badge) if the description contains ... |
| - [default_from_description](#default_from_description ) | No | boolean | No | - | Extract the default value of a property from the description like this: ''[Defau ... |
| - [copy_css](#copy_css ) | No | boolean | No | - | Copy 'schema_doc.css' to the same directory as 'RESULT_FILE' after generation. |
| - [copy_js](#copy_js ) | No | boolean | No | - | Copy 'schema_doc.min.js' to the same directory as 'RESULT_FILE' after generation ... |
Expand Down Expand Up @@ -133,12 +133,13 @@ This option determines the number of times to recursively follow definitions loo

In other words, if a schema has a deeply nested element that refers to itself, this option may need to be increased.

## <a name="deprecated_from_description"></a>8. [Optional] Property `JSON Schema for Humans configuration file > deprecated_from_description`
## <a name="deprecated_from_description"></a>8. [Optional]~~ Property `JSON Schema for Humans configuration file > deprecated_from_description`~~

| Type | `boolean` |
| ----------- | --------- |
| **Default** | `false` |
| | |
| Type | `boolean` |
| -------------- | ------------ |
| **Deprecated** | [Deprecated] |
| **Default** | `false` |
| | |

**Description:** Mark a property as deprecated (with a big red badge) if the description contains the string `[Deprecated`.

Expand Down
40 changes: 32 additions & 8 deletions docs/examples/examples_md_default/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- [1. [Optional]~~ Property `root > deprecated1`~~](#deprecated1)
- [2. [Optional]~~ Property `root > deprecated2`~~](#deprecated2)
- [3. [Optional] Property `root > not_deprecated`](#not_deprecated)
- [3. [Optional]~~ Property `root > deprecated3`~~](#deprecated3)
- [4. [Optional]~~ Property `root > deprecated4`~~](#deprecated4)
- [5. [Optional] Property `root > not_deprecated`](#not_deprecated)

| Type | `object` |
| ------------------------- | ------------------------------------------------------------------------- |
Expand All @@ -11,12 +13,14 @@

**Description:** Test schema with deprecated in description

| Property | Pattern | Type | Deprecated | Definition | Title/Description |
| ------------------------------------ | ------- | ------ | ------------ | ---------- | ------------------------------------------- |
| - [deprecated1](#deprecated1 ) | No | object | [Deprecated] | - | [Deprecated] |
| - [deprecated2](#deprecated2 ) | No | object | [Deprecated] | - | [Deprecated - Use 'not_deprecated' instead] |
| - [not_deprecated](#not_deprecated ) | No | string | No | - | - |
| | | | | | |
| Property | Pattern | Type | Deprecated | Definition | Title/Description |
| ------------------------------------ | ------- | ------ | ------------ | ---------- | --------------------------------------------------- |
| - [deprecated1](#deprecated1 ) | No | object | [Deprecated] | - | [Deprecated] |
| - [deprecated2](#deprecated2 ) | No | object | [Deprecated] | - | [Deprecated - Use 'not_deprecated' instead] |
| - [deprecated3](#deprecated3 ) | No | object | [Deprecated] | - | This is [Deprecated] |
| - [deprecated4](#deprecated4 ) | No | object | [Deprecated] | - | This is [Deprecated - Use 'not_deprecated' instead] |
| - [not_deprecated](#not_deprecated ) | No | string | No | - | - |
| | | | | | |

## <a name="deprecated1"></a>1. [Optional]~~ Property `root > deprecated1`~~

Expand All @@ -38,7 +42,27 @@

**Description:** [Deprecated - Use `not_deprecated` instead]

## <a name="not_deprecated"></a>3. [Optional] Property `root > not_deprecated`
## <a name="deprecated3"></a>3. [Optional]~~ Property `root > deprecated3`~~

| Type | `object` |
| ------------------------- | ------------------------------------------------------------------------- |
| **Deprecated** | [Deprecated] |
| **Additional properties** | [[Any type: allowed]](# "Additional Properties of any type are allowed.") |
| | |

**Description:** This is [Deprecated]

## <a name="deprecated4"></a>4. [Optional]~~ Property `root > deprecated4`~~

| Type | `object` |
| ------------------------- | ------------------------------------------------------------------------- |
| **Deprecated** | [Deprecated] |
| **Additional properties** | [[Any type: allowed]](# "Additional Properties of any type are allowed.") |
| | |

**Description:** This is [Deprecated - Use `not_deprecated` instead]

## <a name="not_deprecated"></a>5. [Optional] Property `root > not_deprecated`

| Type | `string` |
| ---- | -------- |
Expand Down
13 changes: 7 additions & 6 deletions docs/examples/examples_md_nested_default/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- [5. [Optional] Property JSON Schema for Humans configuration file > collapse_long_descriptions](#collapse_long_descriptions)
- [6. [Optional] Property JSON Schema for Humans configuration file > link_to_reused_ref](#link_to_reused_ref)
- [7. [Optional] Property JSON Schema for Humans configuration file > recursive_detection_depth](#recursive_detection_depth)
- [8. [Optional] Property JSON Schema for Humans configuration file > deprecated_from_description](#deprecated_from_description)
- [8. [Optional]~~ Property JSON Schema for Humans configuration file > deprecated_from_description~~](#deprecated_from_description)
- [9. [Optional] Property JSON Schema for Humans configuration file > default_from_description](#default_from_description)
- [10. [Optional] Property JSON Schema for Humans configuration file > copy_css](#copy_css)
- [11. [Optional] Property JSON Schema for Humans configuration file > copy_js](#copy_js)
Expand Down Expand Up @@ -159,15 +159,16 @@ In other words, if a schema has a deeply nested element that refers to itself, t
</details>

<details>
<summary><strong> <a name="deprecated_from_description"></a>8. [Optional] Property JSON Schema for Humans configuration file > deprecated_from_description</strong>
<summary><strong> <a name="deprecated_from_description"></a>8. [Optional]~~ Property JSON Schema for Humans configuration file > deprecated_from_description~~</strong>

</summary>
<blockquote>

| Type | `boolean` |
| ----------- | --------- |
| **Default** | `false` |
| | |
| Type | `boolean` |
| -------------- | ------------ |
| **Deprecated** | [Deprecated] |
| **Default** | `false` |
| | |

**Description:** Mark a property as deprecated (with a big red badge) if the description contains the string `[Deprecated`.

Expand Down
40 changes: 38 additions & 2 deletions docs/examples/examples_md_nested_default/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- [1. [Optional]~~ Property root > deprecated1~~](#deprecated1)
- [2. [Optional]~~ Property root > deprecated2~~](#deprecated2)
- [3. [Optional] Property root > not_deprecated](#not_deprecated)
- [3. [Optional]~~ Property root > deprecated3~~](#deprecated3)
- [4. [Optional]~~ Property root > deprecated4~~](#deprecated4)
- [5. [Optional] Property root > not_deprecated](#not_deprecated)

| Type | `object` |
| ------------------------- | ------------------------------------------------------------------------- |
Expand Down Expand Up @@ -46,7 +48,41 @@
</details>

<details>
<summary><strong> <a name="not_deprecated"></a>3. [Optional] Property root > not_deprecated</strong>
<summary><strong> <a name="deprecated3"></a>3. [Optional]~~ Property root > deprecated3~~</strong>

</summary>
<blockquote>

| Type | `object` |
| ------------------------- | ------------------------------------------------------------------------- |
| **Deprecated** | [Deprecated] |
| **Additional properties** | [[Any type: allowed]](# "Additional Properties of any type are allowed.") |
| | |

**Description:** This is [Deprecated]

</blockquote>
</details>

<details>
<summary><strong> <a name="deprecated4"></a>4. [Optional]~~ Property root > deprecated4~~</strong>

</summary>
<blockquote>

| Type | `object` |
| ------------------------- | ------------------------------------------------------------------------- |
| **Deprecated** | [Deprecated] |
| **Additional properties** | [[Any type: allowed]](# "Additional Properties of any type are allowed.") |
| | |

**Description:** This is [Deprecated - Use `not_deprecated` instead]

</blockquote>
</details>

<details>
<summary><strong> <a name="not_deprecated"></a>5. [Optional] Property root > not_deprecated</strong>

</summary>
<blockquote>
Expand Down
Loading

0 comments on commit de54b27

Please sign in to comment.