Repository navigation
Openapi import advanced option tenant and prefix - #176
Conversation
Openapi import advanced option tenant and prefix
Reviewer's GuideThis PR extends the OpenAPI import flow with optional tenant and prefix parameters by adding an “Advanced Options” UI in the frontend, updating the import service to send those values, and enhancing the backend converter and handler to apply them during conversion. Sequence diagram for OpenAPI import with tenant and prefixsequenceDiagram
actor User
participant UI as Frontend UI
participant API as Backend API
participant Converter as OpenAPI Converter
User->>UI: Select file, (optionally) set tenant and prefix
UI->>API: POST /openapi/import (file, tenantId, prefix)
API->>Converter: ConvertWithOptions(file, tenantId, prefix)
Converter-->>API: MCPConfig
API-->>UI: Success/Error response
UI-->>User: Show notification
Class diagram for OpenAPI import backend changesclassDiagram
class OpenAPI {
+HandleImport(c *gin.Context)
}
class Converter {
+Convert(specData []byte) *MCPConfig
+ConvertWithOptions(specData []byte, tenant, prefix string) *MCPConfig
}
OpenAPI --> Converter : uses
Converter --> MCPConfig : returns
class MCPConfig {
+Tenant string
+Routers []Router
}
class Router {
+Prefix string
}
MCPConfig --> Router : has many
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @boston008 - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `web/src/pages/gateway/components/OpenAPIImport.tsx:76` </location>
<code_context>
}`}
>
- <input {...getInputProps()} />
+ <input {...getInputProps()} style={{ display: 'none' }} />
<LocalIcon icon="lucide:upload" className="text-4xl mb-4 text-primary" />
{isDragActive ? (
</code_context>
<issue_to_address>
Hiding the file input with inline style may impact accessibility.
Consider alternatives like a 'visually-hidden' class or appropriate ARIA attributes to ensure the input remains accessible to screen readers.
Suggested implementation:
```typescript
<input {...getInputProps()} className="visually-hidden" />
```
If the `visually-hidden` class does not already exist in your global CSS (e.g., `index.css` or `globals.css`), add the following CSS:
```css
.visually-hidden {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| }`} | ||
| > | ||
| <input {...getInputProps()} /> | ||
| <input {...getInputProps()} style={{ display: 'none' }} /> |
There was a problem hiding this comment.
suggestion: Hiding the file input with inline style may impact accessibility.
Consider alternatives like a 'visually-hidden' class or appropriate ARIA attributes to ensure the input remains accessible to screen readers.
Suggested implementation:
<input {...getInputProps()} className="visually-hidden" />If the visually-hidden class does not already exist in your global CSS (e.g., index.css or globals.css), add the following CSS:
.visually-hidden {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
}|
LGTM! Thanks! |
Openapi import advanced option tenant and prefix
Fix slect file button
Summary by Sourcery
Add advanced tenant and prefix options to the OpenAPI import flow, extend client and server to handle these options during conversion, fetch tenants dynamically, and fix the file selection button behavior.
New Features:
Bug Fixes:
Enhancements: