Skip to content

Commit 7f3b259

Browse files
authored
Rest required previews are deprecated (github#26527)
1 parent d4984a4 commit 7f3b259

File tree

4 files changed

+14
-31
lines changed

4 files changed

+14
-31
lines changed

components/rest/PreviewsRow.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import { useTranslation } from 'components/hooks/useTranslation'
33

44
type Props = {
55
slug: string
6-
hasRequiredPreviews: boolean
76
xGitHub: xGitHub
87
}
98

10-
export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
9+
export function PreviewsRow({ slug, xGitHub }: Props) {
1110
const { t } = useTranslation('products')
1211
const hasPreviews = xGitHub.previews && xGitHub.previews.length > 0
1312

@@ -19,21 +18,17 @@ export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
1918
<td>string</td>
2019
<td>header</td>
2120
<td>
22-
{hasRequiredPreviews ? (
23-
<p>{t('rest.reference.preview_notice_to_change')}.</p>
24-
) : (
25-
<p className="m-0">
26-
Setting to
27-
<code>application/vnd.github.v3+json</code> is recommended.
28-
{hasPreviews && (
29-
<a href={`#${slug}-preview-notices`} className="d-inline">
30-
{xGitHub.previews.length > 1
31-
? ` ${t('rest.reference.see_preview_notices')}`
32-
: ` ${t('rest.reference.see_preview_notice')}`}
33-
</a>
34-
)}
35-
</p>
36-
)}
21+
<p className="m-0">
22+
Setting to
23+
<code>application/vnd.github.v3+json</code> is recommended.
24+
{hasPreviews && (
25+
<a href={`#${slug}-preview-notices`} className="d-inline">
26+
{xGitHub.previews.length > 1
27+
? ` ${t('rest.reference.see_preview_notices')}`
28+
: ` ${t('rest.reference.see_preview_notice')}`}
29+
</a>
30+
)}
31+
</p>
3732
</td>
3833
</tr>
3934
)

components/rest/RestOperation.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ type Props = {
1414

1515
export function RestOperation({ operation }: Props) {
1616
const previews = operation['x-github'].previews
17-
const hasRequiredPreviews = previews
18-
? previews.filter((preview) => preview.required).length > 0
19-
: false
2017

2118
return (
2219
<div>
@@ -29,7 +26,6 @@ export function RestOperation({ operation }: Props) {
2926
{operation.parameters && (
3027
<RestParameterTable
3128
slug={operation.slug}
32-
hasRequiredPreviews={hasRequiredPreviews}
3329
xGitHub={operation['x-github']}
3430
parameters={operation.parameters}
3531
bodyParameters={operation.bodyParameters}

components/rest/RestParameterTable.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,12 @@ import { BodyParameterRows } from './BodyParametersRows'
88

99
type Props = {
1010
slug: string
11-
hasRequiredPreviews: boolean
1211
xGitHub: xGitHub
1312
parameters: Array<Parameter>
1413
bodyParameters: Array<BodyParameter>
1514
}
1615

17-
export function RestParameterTable({
18-
slug,
19-
hasRequiredPreviews,
20-
xGitHub,
21-
parameters,
22-
bodyParameters,
23-
}: Props) {
16+
export function RestParameterTable({ slug, xGitHub, parameters, bodyParameters }: Props) {
2417
const { t } = useTranslation('products')
2518

2619
return (
@@ -38,7 +31,7 @@ export function RestParameterTable({
3831
</tr>
3932
</thead>
4033
<tbody>
41-
<PreviewsRow slug={slug} hasRequiredPreviews={hasRequiredPreviews} xGitHub={xGitHub} />
34+
<PreviewsRow slug={slug} xGitHub={xGitHub} />
4235
<ParameterRows parameters={parameters} />
4336
<BodyParameterRows slug={slug} bodyParameters={bodyParameters} />
4437
</tbody>

components/rest/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export interface Operation {
66
notes: Array<string>
77
requestPath: string
88
responses: Array<CodeResponse>
9-
hasRequiredPreviews: boolean
109
parameters: Array<Parameter>
1110
bodyParameters: Array<BodyParameter>
1211
'x-github': xGitHub

0 commit comments

Comments
 (0)