Skip to content

Commit 2b42766

Browse files
authored
Fix deprecation notice for Docusaurus 3.10.0 strict admonition syntax (#1423)
* Strict Admonition syntax * add xDeprecatedDescription
1 parent 2f80d44 commit 2b42766

2 files changed

Lines changed: 110 additions & 1 deletion

File tree

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
openapi: 3.1.1
2+
info:
3+
title: Deprecated Description
4+
description: Demonstrates x-deprecated-description extension.
5+
version: 1.0.0
6+
tags:
7+
- name: deprecated
8+
description: deprecation tests
9+
paths:
10+
/deprecated:
11+
get:
12+
tags:
13+
- deprecated
14+
summary: deprecated fields with x-deprecated-description
15+
deprecated: true
16+
x-deprecated-description: |
17+
This endpoint is deprecated and will be removed in version 2.0. Please use the /new-endpoint instead.
18+
description: |
19+
Schema:
20+
```yaml
21+
type: object
22+
properties:
23+
id:
24+
type: string
25+
description: Resource identifier
26+
legacyField:
27+
type: string
28+
deprecated: true
29+
x-deprecated-description: |
30+
This field is deprecated. Use 'newField' instead.
31+
newField:
32+
type: string
33+
description: |
34+
Replacement for legacyField
35+
status:
36+
type: string
37+
enum:
38+
- active
39+
- inactive
40+
- deprecated
41+
description: |
42+
Resource status
43+
metadata:
44+
type: object
45+
deprecated: true
46+
x-deprecated-description: |
47+
Metadata object is deprecated and will be removed in v2.0
48+
properties:
49+
tags:
50+
type: array
51+
items:
52+
type: string
53+
required:
54+
- id
55+
```
56+
responses:
57+
"200":
58+
description: Successful response
59+
content:
60+
application/json:
61+
schema:
62+
type: object
63+
properties:
64+
id:
65+
type: string
66+
description: Resource identifier
67+
legacyField:
68+
type: string
69+
deprecated: true
70+
x-deprecated-description: |
71+
This field is deprecated and will be removed in version 2.0. Please use 'newField' instead.
72+
newField:
73+
type: string
74+
description: |
75+
Updated field that replaces legacyField
76+
status:
77+
type: string
78+
enum:
79+
- active
80+
- inactive
81+
- deprecated
82+
description: Resource status
83+
oldMetadata:
84+
type: object
85+
deprecated: true
86+
x-deprecated-description: |
87+
Legacy metadata object. Use the new 'attributes' field for future implementations.
88+
properties:
89+
version:
90+
type: string
91+
deprecated: true
92+
x-deprecated-description: Version tracking moved to header
93+
tags:
94+
type: array
95+
items:
96+
type: string
97+
attributes:
98+
type: object
99+
description: New attributes object replacing oldMetadata
100+
properties:
101+
category:
102+
type: string
103+
labels:
104+
type: array
105+
items:
106+
type: string
107+
required:
108+
- id
109+
- status

packages/docusaurus-plugin-openapi-docs/src/markdown/createDeprecationNotice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { clean, guard, Props, render } from "./utils";
99

1010
function createAdmonition({ children }: Props) {
11-
return `:::caution deprecated\n\n${render(children)}\n\n:::`;
11+
return `:::caution[deprecated]\n\n${render(children)}\n\n:::`;
1212
}
1313

1414
interface DeprecationNoticeProps {

0 commit comments

Comments
 (0)