Skip to content

feat: es-schema module poc #232

Merged
margaretjgu merged 5 commits into
mainfrom
feat/extract-es-schemas
Apr 28, 2026
Merged

feat: es-schema module poc #232
margaretjgu merged 5 commits into
mainfrom
feat/extract-es-schemas

Conversation

@margaretjgu
Copy link
Copy Markdown
Member

@margaretjgu margaretjgu commented Apr 24, 2026

Summary

  • Extract all 48 Zod ES API schema files from src/es/apis/schemas/ into a new @elastic/es-schemas workspace package under packages/es-schemas/
  • Rewrite all 57 API definition imports to use @elastic/es-schemas
  • Update build pipeline (tsc -p packages/es-schemas && tsc) to compile the sub-package first
  • Add @elastic/es-schemas to Release Please config for independent versioning

Motivation

Closes #78. Makes the Zod request schemas independently consumable by other tools (e.g. Kibana Workflows, external validators) without depending on the full CLI.

What changed

Area Before After
Schema location src/es/apis/schemas/*.ts packages/es-schemas/src/*.ts
Import path ./schemas/<stem>.ts @elastic/es-schemas/<stem>.js
Build tsc tsc -p packages/es-schemas && tsc
Coverage exclude src/es/apis/schemas/** removed (schemas no longer in src/)

Follow-ups

  • Companion codegen PR needed in elastic-client-generator-js to emit @elastic/es-schemas imports
  • npm publish config for @elastic/es-schemas once versioning is finalized
  • Coordinate with Kibana Workflows team to adopt the package

Test plan

  • npm run build compiles both packages
  • npm test passes (unit + license check)
  • tsc --noEmit typechecks cleanly
  • Codegen tests in elastic-client-generator-js pass with updated import paths
  • Bun build works (no -w flag conflict)

@margaretjgu margaretjgu marked this pull request as draft April 24, 2026 17:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 9.57s
✅ REPOSITORY gitleaks yes no no 80.55s
✅ REPOSITORY git_diff yes no no 0.08s
✅ REPOSITORY secretlint yes no no 2.46s
✅ REPOSITORY trivy yes no no 13.6s
✅ TYPESCRIPT eslint 105 0 0 12.92s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@margaretjgu margaretjgu marked this pull request as ready for review April 28, 2026 15:12
@margaretjgu margaretjgu requested a review from JoshMock April 28, 2026 15:13
Copy link
Copy Markdown
Member

@JoshMock JoshMock left a comment

Choose a reason for hiding this comment

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

LGTM!

As with #227, we can work on actually publishing stuff in packages/ to npm as standalone packages later. Just validating that extracting the code out of the critical path works correctly is a win.

Also note that the work in #79 will need to be modified to include this codegen work. Whichever PR gets merged first will inform how we go about that.

@margaretjgu margaretjgu force-pushed the feat/extract-es-schemas branch from 2041db4 to d368efa Compare April 28, 2026 18:41
@margaretjgu margaretjgu enabled auto-merge (squash) April 28, 2026 18:41
@margaretjgu margaretjgu merged commit 61ba1d8 into main Apr 28, 2026
17 of 18 checks passed
@margaretjgu margaretjgu deleted the feat/extract-es-schemas branch April 28, 2026 18:46
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.

Extract Zod schemas into a reusable library

2 participants