-
Notifications
You must be signed in to change notification settings - Fork 14
Fix the issue where multiple identical breaks UI #233
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,9 @@ import ( | |
|
|
||
| // DereferenceOptions holds configuration for schema dereferencing operations. | ||
| type DereferenceOptions struct { | ||
| Client *client.Client | ||
| Cwd string | ||
| Client *client.Client | ||
| Cwd string | ||
| StripID bool | ||
| } | ||
|
|
||
| // relativeFilePathPattern only accepts relative file path prefixes "./" and "../" | ||
|
|
@@ -114,6 +115,13 @@ func dereferenceMassdriverRef(hydratedSchema map[string]any, schema map[string]a | |
| } | ||
| } | ||
|
|
||
| // This is a hack to get around the issue of the UI choking if the params schema has 2 or more of the same $id in it. | ||
| // We need the "$id" in artifacts and connections, but we need to strip it out of params and ui schemas, hence the conditional. | ||
| // This logic should be removed when we have a better solution for this in the UI/API - probably after resource types are in OCI | ||
| if opts.StripID { | ||
| delete(referencedSchema, "$id") | ||
| } | ||
|
Comment on lines
+118
to
+123
|
||
|
|
||
| hydratedSchema, err = replaceRef(schema, referencedSchema, opts) | ||
| if err != nil { | ||
| return hydratedSchema, err | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StripIDreads like it will remove "$id" everywhere, but the current implementation only deletes it for Massdriver remote refs (indereferenceMassdriverRef). To avoid misuse/confusion for future callers, consider renaming the option (or documenting it in the field comment) to make the scope explicit (e.g., only applies to Massdriver-referenced schemas).