Skip to content

Commit c12f5f8

Browse files
committed
Fix failed merge
1 parent b2ccb16 commit c12f5f8

File tree

1 file changed

+7
-76
lines changed

1 file changed

+7
-76
lines changed

Diff for: packages/react-openapi/src/OpenAPISchema.tsx

+7-76
Original file line numberDiff line numberDiff line change
@@ -39,53 +39,21 @@ function OpenAPISchemaProperty(props: {
3939

4040
const id = useId();
4141

42-
<<<<<<< HEAD
4342
const circularRefId = parentCircularRefs.get(schema);
4443
// Avoid recursing infinitely, and instead render a link to the parent schema
4544
if (circularRefId) {
4645
return <OpenAPISchemaCircularRef id={circularRefId} schema={schema} />;
4746
}
48-
=======
49-
return (
50-
<div id={id} className={clsx('openapi-schema', className)}>
51-
<OpenAPISchemaPresentation context={context} property={property} />
52-
{(() => {
53-
const circularRefId = parentCircularRefs.get(schema);
54-
// Avoid recursing infinitely, and instead render a link to the parent schema
55-
if (circularRefId) {
56-
return <OpenAPISchemaCircularRef id={circularRefId} schema={schema} />;
57-
}
58-
>>>>>>> main
5947

6048
const circularRefs = new Map(parentCircularRefs);
6149
circularRefs.set(schema, id);
6250

63-
<<<<<<< HEAD
6451
const properties = getSchemaProperties(schema);
65-
=======
66-
const properties = getSchemaProperties(schema);
67-
if (properties?.length) {
68-
return (
69-
<OpenAPIDisclosure
70-
icon={context.icons.plus}
71-
label={(isExpanded) =>
72-
getDisclosureLabel({ schema, isExpanded, context })
73-
}
74-
>
75-
<OpenAPISchemaProperties
76-
properties={properties}
77-
circularRefs={circularRefs}
78-
context={context}
79-
/>
80-
</OpenAPIDisclosure>
81-
);
82-
}
83-
>>>>>>> main
8452

8553
const ancestors = new Set(circularRefs.keys());
8654
const alternatives = getSchemaAlternatives(schema, ancestors);
8755

88-
const header = <OpenAPISchemaPresentation property={property} />;
56+
const header = <OpenAPISchemaPresentation context={context} property={property} />;
8957
const content = (() => {
9058
if (properties?.length) {
9159
return (
@@ -121,7 +89,7 @@ function OpenAPISchemaProperty(props: {
12189
icon={context.icons.plus}
12290
className={clsx('openapi-schema', className)}
12391
header={header}
124-
label={(isExpanded) => getDisclosureLabel(schema, isExpanded)}
92+
label={(isExpanded) => getDisclosureLabel({ schema, isExpanded, context })}
12593
>
12694
{content}
12795
</OpenAPIDisclosure>
@@ -253,12 +221,11 @@ function OpenAPISchemaAlternative(props: {
253221
const { schema, circularRefs, context } = props;
254222
const properties = getSchemaProperties(schema);
255223

256-
<<<<<<< HEAD
257224
return properties?.length ? (
258225
<OpenAPIDisclosure
259226
icon={context.icons.plus}
260-
header={<OpenAPISchemaPresentation property={{ schema }} />}
261-
label={(isExpanded) => getDisclosureLabel(schema, isExpanded)}
227+
header={<OpenAPISchemaPresentation property={{ schema }} context={context} />}
228+
label={(isExpanded) => getDisclosureLabel({ schema, isExpanded, context })}
262229
>
263230
<OpenAPISchemaProperties
264231
properties={properties}
@@ -272,32 +239,6 @@ function OpenAPISchemaAlternative(props: {
272239
circularRefs={circularRefs}
273240
context={context}
274241
/>
275-
=======
276-
return (
277-
<>
278-
{description ? (
279-
<Markdown source={description} className="openapi-schema-description" />
280-
) : null}
281-
<OpenAPIDisclosure
282-
icon={context.icons.plus}
283-
label={(isExpanded) => getDisclosureLabel({ schema, isExpanded, context })}
284-
>
285-
{properties?.length ? (
286-
<OpenAPISchemaProperties
287-
properties={properties}
288-
circularRefs={circularRefs}
289-
context={context}
290-
/>
291-
) : (
292-
<OpenAPISchemaProperty
293-
property={{ schema }}
294-
circularRefs={circularRefs}
295-
context={context}
296-
/>
297-
)}
298-
</OpenAPIDisclosure>
299-
</>
300-
>>>>>>> main
301242
);
302243
}
303244

@@ -677,23 +618,13 @@ function getDisclosureLabel(props: {
677618
if (schema.type === 'array' && !!schema.items) {
678619
if (schema.items.oneOf) {
679620
label = tString(context.translation, 'available_items').toLowerCase();
680-
}
681-
// Fallback to "properties" for enums and objects
682-
else if (schema.items.enum || schema.items.type === 'object') {
683-
<<<<<<< HEAD
684-
label = 'properties';
685-
=======
686-
label = tString(context.translation, 'child_attributes').toLowerCase();
687-
>>>>>>> main
621+
} else if (schema.items.enum || schema.items.type === 'object') {
622+
label = tString(context.translation, 'properties').toLowerCase();
688623
} else {
689624
label = schema.items.title ?? schema.title ?? getSchemaTitle(schema.items);
690625
}
691626
} else {
692-
<<<<<<< HEAD
693-
label = schema.title || 'properties';
694-
=======
695-
label = schema.title || tString(context.translation, 'child_attributes').toLowerCase();
696-
>>>>>>> main
627+
label = schema.title || tString(context.translation, 'properties').toLowerCase();
697628
}
698629

699630
return `${isExpanded ? tString(context.translation, 'hide') : tString(context.translation, 'show')} ${label}`;

0 commit comments

Comments
 (0)