Skip to content

feat(api): expose schema inference and validation in the public API#50

Open
shokurov wants to merge 1 commit into
lovasoa:mainfrom
shokurov:feat/inference-public-api
Open

feat(api): expose schema inference and validation in the public API#50
shokurov wants to merge 1 commit into
lovasoa:mainfrom
shokurov:feat/inference-public-api

Conversation

@shokurov

Copy link
Copy Markdown
Collaborator

Summary

Re-exports the bare UI-free schema inference and validation functions from the public barrel (src/index.ts) so they can be consumed as a library API, not just through the Monaco-backed dialogs.

Newly exported (all tagged @public for api-extractor):

Symbol Source Kind
inferSchema src/lib/schema-inference.ts function
createSchemaFromJson src/lib/schema-inference.ts function
validateJson src/utils/jsonValidator.ts function
ValidationResult src/utils/jsonValidator.ts type
ValidationError src/utils/jsonValidator.ts type

Motivation

A downstream schema editors need "generate schema from a JSON example" and "validate an example against a schema" as plain function calls. These already exist as pure, Monaco-free functions but weren't part of the public surface.

Notes

  • No Monaco coupling. The exported functions depend only on ajv / ajv-formats and internal types. The Monaco-backed InferSchemaDialog / ValidateJsonDialog are intentionally not added here (they're already exported separately).
  • No behavior changes — only @public JSDoc tags and barrel re-exports.

Verification

  • tsc --build — clean
  • biome check — clean
  • npm run build (rslib + dts rollup) — all 5 symbols present in dist/index.d.ts as export declare
  • npm test — 65 passed, 0 failed

Re-export createSchemaFromJson/inferSchema and validateJson with its
ValidationResult/ValidationError types from src/index.ts, tagged @public
for api-extractor. These are Monaco-free pure functions needed by the
BDK schema editor (RSSL-11775); the Monaco-backed dialogs are not
re-exported.

Document the exported functions (params/returns/behavior) and every
member of the ValidationResult/ValidationError types so the public
.d.ts rollup carries meaningful TSDoc.

RSSL-11797

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shokurov shokurov requested a review from lovasoa June 26, 2026 10:14
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.

1 participant