Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nx-dev): display internal & deprecated options last #14519

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions nx-dev/feature-package-schema-viewer/src/lib/schema-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ function extractPropertiesByImportance(properties: PropertyModel[]): {
rest: [],
};
for (const property of properties) {
if (property.isRequired) {
result.required.push(property);
continue;
}
if (isPropertyDeprecated(property.initialSchema)) {
result.deprecated.push(property);
continue;
Expand Down Expand Up @@ -156,14 +160,6 @@ export function SchemaViewer({
});
}

const renderedProps = renderProps([
...categorizedProperties.required,
...categorizedProperties.important,
...categorizedProperties.rest,
...categorizedProperties.internal,
...categorizedProperties.deprecated,
]);

const additionalProperties = new Array<JSX.Element>();
if (typeof schema.additionalProperties === 'boolean') {
if (schema.additionalProperties) {
Expand Down Expand Up @@ -231,7 +227,7 @@ export function SchemaViewer({
);

const hasProperties =
renderedProps.length > 0 ||
Object.keys(properties).length > 0 ||
renderedPatternProperties.length > 0 ||
additionalProperties.length > 0;

Expand Down Expand Up @@ -267,14 +263,21 @@ export function SchemaViewer({
}

let allRenderedProperties = <></>;
const renderedProps = [
renderProps([
...categorizedProperties.required,
...categorizedProperties.important,
...categorizedProperties.rest,
]),
...renderedPatternProperties,
...additionalProperties,
renderProps([
...categorizedProperties.internal,
...categorizedProperties.deprecated,
]),
];
if (hasProperties) {
allRenderedProperties = (
<>
{renderedProps}
{renderedPatternProperties}
{additionalProperties}
</>
);
allRenderedProperties = <>{renderedProps}</>;
}

return (
Expand Down