stoplightio / json-schema-viewer

A JSON Schema viewer React component
Apache License 2.0
177 stars 37 forks source link

fix: combiners with differing types render nothing for some children #222

Closed BelfordZ closed 1 year ago

BelfordZ commented 1 year ago

Motivation and Context

fixes #221

Description

This pr will render a SchemaRow when you've chosen a combiner subschema that is a simple type

How Has This Been Tested?

Manually via storybook

Screenshot(s)/recordings(s)

Before: image

After: image

Types of changes

Checklist

marbemac commented 1 year ago

Ditto my comment in #224 - @P0lip @mnaumanali94 any chance ya'll could take a look at this in the near future? Thank you!

P0lip commented 1 year ago
commit 55087a54f70fc1f7b599712495cccfae76bb0f26
Author: Jakub Rożek <jakub@stoplight.io>
Date:   Thu May 25 16:42:26 2023 +0200

    style: prettier

diff --git a/src/components/SchemaRow/TopLevelSchemaRow.tsx b/src/components/SchemaRow/TopLevelSchemaRow.tsx
index 2f18da6..7a58eba 100644
--- a/src/components/SchemaRow/TopLevelSchemaRow.tsx
+++ b/src/components/SchemaRow/TopLevelSchemaRow.tsx
@@ -88,11 +88,9 @@ export const TopLevelSchemaRow = ({
             currentNestingLevel={nestingLevel}
             parentNodeId={nodeId}
           />
-        ) : combiner ? <SchemaRow
-                         schemaNode={selectedChoice.type}
-                         nestingLevel={nestingLevel} /> : null
-
-        }
+        ) : combiner ? (
+          <SchemaRow schemaNode={selectedChoice.type} nestingLevel={nestingLevel} />
+        ) : null}
       </>
     );
   }

could you apply the following change? This is for prettier to pass.

Alternatively, I can push it myself if you allow pushes from maintainers.

BelfordZ commented 1 year ago

updated! thanks for taking a look @P0lip & @marbemac !

BelfordZ commented 1 year ago

Thank you <3