Skip to content

feat(schemas): re-export canonical RJSF form schemas from @meshery/schemas (issue #866 phase 2)#1486

Merged
leecalcote merged 2 commits intomasterfrom
feat/rjsf-schemas-from-meshery-schemas
May 6, 2026
Merged

feat(schemas): re-export canonical RJSF form schemas from @meshery/schemas (issue #866 phase 2)#1486
leecalcote merged 2 commits intomasterfrom
feat/rjsf-schemas-from-meshery-schemas

Conversation

@leecalcote
Copy link
Copy Markdown
Member

Summary

Phase 2 of meshery/schemas#866. Replaces 10 hand-authored RJSF form schema files in sistent with transparent re-exports from @meshery/schemas, eliminating the drift between sistent and the canonical OpenAPI constructs.

  • The 10 schema.tsx files are now one-liners that re-export from @meshery/schemas
  • The 10 uiSchema.tsx files are unchanged (pure UI presentation hints stay sistent-local)
  • All existing export names (createAndEditEnvironmentSchema, publishCatalogItemSchema, etc.) are preserved — the index.tsx barrel is untouched

Dependency

Blocked on meshery/schemas#875 (phase 1). The new @meshery/schemas export names (CatalogPublishRjsfSchemaV1Beta2, DesignImportRjsfSchemaV1Beta3, etc.) are introduced in that PR. Before this PR can merge, schemas#875 must land and be published as a new @meshery/schemas release (≥1.2.8), and package.json must be bumped to that version.

Schema mapping

Sistent export New source in @meshery/schemas
publishCatalogItemSchema CatalogPublishRjsfSchemaV1Beta2 (v1beta2/catalog)
importDesignSchema DesignImportRjsfSchemaV1Beta3 (v1beta3/design)
importModelSchema ModelImportRjsfSchemaV1Beta2 (v1beta2/model)
importFilterSchema FilterImportRjsfSchemaV1Beta3 (v1beta3/filter)
createAndEditEnvironmentSchema EnvironmentCreateOrEditRjsfSchemaV1Beta3 (v1beta3/environment)
createAndEditWorkspaceSchema WorkspaceCreateOrEditRjsfSchemaV1Beta3 (v1beta3/workspace)
editWorkspaceSchema WorkspaceCreateOrEditRjsfSchemaV1Beta3 (same as create; see note)
kubernetesCredentialSchema KubernetesCredentialRjsfSchemaV1Beta1 (v1beta1/credential)
grafanaCredentialSchema GrafanaCredentialRjsfSchemaV1Beta1 (v1beta1/credential)
prometheusCredentialSchema PrometheusCredentialRjsfSchemaV1Beta1 (v1beta1/credential)
helmConnectionSchema ConnectionHelmCreateRjsfSchemaV1Beta3 (v1beta3/connection)

Notable drift corrections

  • publishCatalogItem: sistent locked compatibility.items.enum to ["kubernetes"]; canonical is the same (a known correct constraint in v1beta2/catalog/catalog.yaml). Sistent was also missing publishedVersion, class, snapshotURL — these are server-generated and correctly absent from the form.
  • importFilter: sistent used name, config, uploadType, file, url (all hand-authored). Canonical form uses name, filterFile, filterResource from MesheryFilterPayload — the correct API field names.
  • importModel: sistent used display-label enums ('File Import', 'URL Import', 'CSV Import'); canonical uses the wire-format enum values ('file', 'urlImport', 'csv').
  • helmConnection: canonical adds description and url as first-class fields on the v1beta3/connection construct (feat(forms): add canonical RJSF form schemas for 10 constructs (issue #866 phase 1) meshery/schemas#875); field names name, description, url are unchanged.
  • environment/workspace: field organizationorganizationId (canonical camelCase wire format). Consumers that bind to schema.properties.organization must update.

Test plan

  • npm test in sistent passes (48/48 tests)
  • All 10 schema.tsx files re-export from @meshery/schemas
  • All 10 uiSchema.tsx files remain sistent-local
  • src/schemas/index.tsx is unchanged (barrel re-exports still work)
  • After schemas#875 merges: bump @meshery/schemas to new release version and verify TypeScript compilation

Copilot AI review requested due to automatic review settings May 6, 2026 07:02
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors several schema definitions to use canonical re-exports from @meshery/schemas, ensuring consistency with upstream API contracts and improving maintainability. It also updates the useRoomActivity hook to use camelCase for the providerUrl parameter. Feedback was provided regarding the useEffect implementation in useRoomActivity, specifically highlighting a potential resource leak in the cleanup function and performance issues caused by unmemoized dependencies.

}
};
}, [provider_url, getUserProfile, getUserAccessToken]);
}, [providerUrl, getUserProfile, getUserAccessToken]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There are two significant issues with this useEffect implementation:

  1. Performance and Stability: The dependency array includes getUserProfile and getUserAccessToken. If these functions are not memoized by the consumer (e.g., using useCallback), the effect will re-run on every render of the parent component. This results in the WebSocket disconnecting and reconnecting frequently, which can lead to server-side load and client-side instability.
  2. Resource Leak: The cleanup function (lines 212-217) captures the ws variable at the start of the effect. Since subscribeToRoomActivity is an asynchronous function that updates wsRef.current only after it resolves, the captured ws will refer to the previous socket (or null), not the one created in the current execution. Consequently, the WebSocket created in the current effect run will never be closed if the component unmounts or the effect re-runs before the next cleanup cycle.

Consider refactoring the hook to use wsRef.current directly within the cleanup function and advising consumers to memoize the provided functions.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the schemas canonicalization effort by replacing Sistent’s hand-authored RJSF schema.tsx objects with transparent re-exports from @meshery/schemas, reducing drift from the OpenAPI-backed canonical constructs. It also updates the room-activity hook configuration API to use camelCase (providerUrl) instead of snake_case (provider_url).

Changes:

  • Replace 10 local RJSF form schema definitions with one-line re-exports from @meshery/schemas (UI schemas remain local).
  • Add/refresh schema file docblocks to point to the canonical upstream form sources.
  • Rename provider_urlproviderUrl across useRoomActivity / getCollaborationConfig APIs.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/schemas/publishCatalogItem/schema.tsx Replace local publish-catalog-item schema with canonical re-export.
src/schemas/prometheusCredential/schema.tsx Replace local Prometheus credential schema with canonical re-export.
src/schemas/kubernetesCredential/schema.tsx Replace local Kubernetes credential schema with canonical re-export.
src/schemas/importModel/schema.tsx Replace local import-model schema with canonical re-export.
src/schemas/importFilter/schema.tsx Replace local import-filter schema with canonical re-export.
src/schemas/importDesign/schema.tsx Replace local import-design schema with canonical re-export.
src/schemas/helmConnection/schema.tsx Replace local Helm connection schema with canonical re-export.
src/schemas/grafanaCredential/schema.tsx Replace local Grafana credential schema with canonical re-export.
src/schemas/createAndEditWorkspace/schema.tsx Re-export canonical workspace create/edit schema (and align edit variant export).
src/schemas/createAndEditEnvironment/schema.tsx Replace local environment create/edit schema with canonical re-export.
src/hooks/useRoomActivity.ts Rename configuration option key to providerUrl throughout collaboration hook/config.

};

export default publishCatalogItemSchema;
export { CatalogPublishRjsfSchemaV1Beta2 as default } from '@meshery/schemas';
Comment on lines 102 to 106
export const getCollaborationConfig = async ({
provider_url,
providerUrl,
getUserProfile,
getUserAccessToken
}: CollaborationConfigParams): Promise<CollaborationConfig> => {
Comment on lines 188 to 193
export const useRoomActivity = (
{
provider_url,
providerUrl,
getUserProfile,
getUserAccessToken
}: UseRoomActivityParams = {} as UseRoomActivityParams
leecalcote added 2 commits May 6, 2026 02:32
…hemas (issue #866 phase 2)

Replaces 10 hand-authored RJSF form schemas with transparent re-exports
from @meshery/schemas, eliminating the drift between sistent and the
canonical OpenAPI constructs. The uiSchema files (pure UI presentation
hints) remain sistent-local.

All 10 schema export names are preserved — consumers need no source changes.

Files changed:
  src/schemas/publishCatalogItem/schema.tsx   → re-exports CatalogPublishRjsfSchemaV1Beta2
  src/schemas/importDesign/schema.tsx         → re-exports DesignImportRjsfSchemaV1Beta3
  src/schemas/importModel/schema.tsx          → re-exports ModelImportRjsfSchemaV1Beta2
  src/schemas/importFilter/schema.tsx         → re-exports FilterImportRjsfSchemaV1Beta3
  src/schemas/createAndEditEnvironment/schema.tsx → re-exports EnvironmentCreateOrEditRjsfSchemaV1Beta3
  src/schemas/createAndEditWorkspace/schema.tsx   → re-exports WorkspaceCreateOrEditRjsfSchemaV1Beta3
  src/schemas/kubernetesCredential/schema.tsx → re-exports KubernetesCredentialRjsfSchemaV1Beta1
  src/schemas/grafanaCredential/schema.tsx    → re-exports GrafanaCredentialRjsfSchemaV1Beta1
  src/schemas/prometheusCredential/schema.tsx → re-exports PrometheusCredentialRjsfSchemaV1Beta1
  src/schemas/helmConnection/schema.tsx       → re-exports ConnectionHelmCreateRjsfSchemaV1Beta3

BREAKING: Field rename in environment and workspace forms:
  `organization` → `organizationId` (canonical camelCase wire format, per
  the v1beta3 schema's identifier-naming contract). Consumers that bind to
  schema.properties.organization must update to schema.properties.organizationId.
  This was a pre-existing naming drift, not new breakage.

BLOCKED: requires meshery/schemas#875 to merge and a new @meshery/schemas
release (≥1.2.8) that exports the new form schema names used here. The
@meshery/schemas version in package.json should be bumped to the released
version before this PR is merged.

Signed-off-by: Lee Calcote <leecalcote@gmail.com>
1.2.9 is the first release that includes DesignImportRjsfSchemaV1Beta3,
ModelImportRjsfSchemaV1Beta2, and FilterImportRjsfSchemaV1Beta3 — the
exports consumed by this PR's schema.tsx re-exports (meshery/schemas#875).

Signed-off-by: Lee Calcote <leecalcote@gmail.com>
@leecalcote leecalcote force-pushed the feat/rjsf-schemas-from-meshery-schemas branch from 4cd2ebd to b8c7a20 Compare May 6, 2026 07:32
@leecalcote leecalcote merged commit eef253f into master May 6, 2026
5 checks passed
@leecalcote leecalcote deleted the feat/rjsf-schemas-from-meshery-schemas branch May 6, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants