Skip to content

Commit a1272e1

Browse files
authored
feat(nx-dev): display internal & deprecated options last (#14519)
1 parent c2be735 commit a1272e1

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

nx-dev/feature-package-schema-viewer/src/lib/schema-viewer.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ function extractPropertiesByImportance(properties: PropertyModel[]): {
7878
rest: [],
7979
};
8080
for (const property of properties) {
81+
if (property.isRequired) {
82+
result.required.push(property);
83+
continue;
84+
}
8185
if (isPropertyDeprecated(property.initialSchema)) {
8286
result.deprecated.push(property);
8387
continue;
@@ -156,14 +160,6 @@ export function SchemaViewer({
156160
});
157161
}
158162

159-
const renderedProps = renderProps([
160-
...categorizedProperties.required,
161-
...categorizedProperties.important,
162-
...categorizedProperties.rest,
163-
...categorizedProperties.internal,
164-
...categorizedProperties.deprecated,
165-
]);
166-
167163
const additionalProperties = new Array<JSX.Element>();
168164
if (typeof schema.additionalProperties === 'boolean') {
169165
if (schema.additionalProperties) {
@@ -231,7 +227,7 @@ export function SchemaViewer({
231227
);
232228

233229
const hasProperties =
234-
renderedProps.length > 0 ||
230+
Object.keys(properties).length > 0 ||
235231
renderedPatternProperties.length > 0 ||
236232
additionalProperties.length > 0;
237233

@@ -267,14 +263,21 @@ export function SchemaViewer({
267263
}
268264

269265
let allRenderedProperties = <></>;
266+
const renderedProps = [
267+
renderProps([
268+
...categorizedProperties.required,
269+
...categorizedProperties.important,
270+
...categorizedProperties.rest,
271+
]),
272+
...renderedPatternProperties,
273+
...additionalProperties,
274+
renderProps([
275+
...categorizedProperties.internal,
276+
...categorizedProperties.deprecated,
277+
]),
278+
];
270279
if (hasProperties) {
271-
allRenderedProperties = (
272-
<>
273-
{renderedProps}
274-
{renderedPatternProperties}
275-
{additionalProperties}
276-
</>
277-
);
280+
allRenderedProperties = <>{renderedProps}</>;
278281
}
279282

280283
return (

0 commit comments

Comments
 (0)