refactor: improve property display ordering and configuration layout
- Sort request body properties: required fields first, then optional - Sort configuration schema properties: required first, then optional - Display configuration type as "SourceConfiguration" instead of "string" - Move oneOf badge inline with configuration header - Position required badge at the end of property line - Improve visual hierarchy by grouping required properties together Changes improve the user experience by: - Making it clear which properties are required vs optional - Displaying accurate type information for configuration field - Maintaining consistent visual layout across all property listings - Reducing clutter by positioning oneOf badge with configuration header 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,14 @@ const ConfigurationFields = ({
|
||||
const requiredFields = selectedConfig.required || [];
|
||||
const properties = selectedConfig.properties || {};
|
||||
|
||||
// Sort properties: required first, then optional
|
||||
const sortedEntries = Object.entries(properties).sort(([nameA], [nameB]) => {
|
||||
const aRequired = requiredFields.includes(nameA);
|
||||
const bRequired = requiredFields.includes(nameB);
|
||||
if (aRequired === bRequired) return 0;
|
||||
return aRequired ? -1 : 1;
|
||||
});
|
||||
|
||||
return (
|
||||
<ul style={{ marginLeft: "1rem", listStyle: "none", padding: 0 }}>
|
||||
<div className="openapi-schema__list-item">
|
||||
@@ -43,7 +51,7 @@ const ConfigurationFields = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{Object.entries(properties).map(([fieldName, fieldSchema]) => (
|
||||
{sortedEntries.map(([fieldName, fieldSchema]) => (
|
||||
<div key={fieldName} className="openapi-schema__list-item">
|
||||
<div>
|
||||
<span className="openapi-schema__container">
|
||||
@@ -150,36 +158,18 @@ export const SourceConfiguration = ({ endpointData }) => {
|
||||
</Combobox>
|
||||
{endpointData?.configurationSchema && (
|
||||
<div style={{ marginTop: "1rem" }}>
|
||||
{endpointData.configurationSchema.description && (
|
||||
<p
|
||||
style={{
|
||||
fontSize: "0.9rem",
|
||||
lineHeight: "1.4",
|
||||
marginBottom: "0.5rem",
|
||||
margin: "0 0 0.5rem 0",
|
||||
}}
|
||||
>
|
||||
{endpointData.configurationSchema.description}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* Show oneOf badge if configuration has multiple options */}
|
||||
{endpointData.configurationSchema.oneOf && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "0.75rem",
|
||||
marginBottom: "0.75rem",
|
||||
flexWrap: "wrap",
|
||||
}}
|
||||
>
|
||||
{/* Header with oneOf badge inline */}
|
||||
<div style={{ display: "flex", alignItems: "center", gap: "0.5rem", marginBottom: "0.75rem" }}>
|
||||
<span className="openapi-schema__property" style={{ fontWeight: 600 }}>
|
||||
configuration
|
||||
</span>
|
||||
<span className="openapi-schema__name">SourceConfiguration</span>
|
||||
{endpointData.configurationSchema.oneOf && (
|
||||
<span className="badge badge--info" style={{ marginBottom: 0 }}>
|
||||
oneOf
|
||||
</span>
|
||||
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Display required properties for selected source */}
|
||||
{selectedSource && endpointData.configurationSchema.oneOf && (
|
||||
|
||||
Reference in New Issue
Block a user