feat(schema): Schema.toTypeScript codegen; named Parameters + propertyMeta - #207
Merged
Merged
Conversation
…yMeta
Add Schema.toTypeScript(schema, name) generating TS declarations (interface
for objects) that mirror ToType: recurses, hoists repeated object shapes to
named interfaces, and emits descriptions as comments.
BREAKING: signature.parameters is now readonly Parameter[] ({ name,
description?, schema }) so argument names/docs are known independently of the
type. Adds Schema.propertyMeta for per-property field docs independent of a
shared property type. ToType and the data-rpc runtime updated; all fixtures
migrated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The installer dropped a CLAUDE.md "do-not-edit" notice into both managed bundle folders. On Claude Code 2.1.286 any CLAUDE.md in the tree switches the project into CLAUDE.md mode and suppresses AGENTS.md discovery project-wide, so a repo that uses AGENTS.md loses all instructions. Name the notice for the repo's convention instead: AGENTS.md by default (also read by Claude Code), CLAUDE.md only for a CLAUDE.md-only repo. An AGENTS.md repo never receives a data-ai CLAUDE.md. Adds install tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…a-to-typescript # Conflicts: # package.json # packages/data-ai/.claude-plugin/plugin.json # packages/data-ai/package.json # packages/data-gpu/package.json # packages/data-lit/package.json # packages/data-persistence/package.json # packages/data-react/package.json # packages/data-rpc/package.json # packages/data-solid/package.json # packages/data-sync/package.json # packages/data-testing/package.json # packages/data/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR carries two independent changes on the branch.
1.
Schema.toTypeScriptcodegen + named parameters +propertyMetaAdds
Schema.toTypeScript(schema, name)— a runtime generator that turns a serviceSchemainto TypeScript type declarations, the source-text counterpart of the type-levelSchema.ToType.Generator
interfacefor object schemas, atypealias otherwise; mirrorsToType(deep-readonlyby default,mutableopts out). Output carries noexportkeyword.oneOf/allOf/anyOf, function signatures, observe/promise/generator values).interfaceand referenced by name; singletons stay inlined. Name source:title→ referencing property key → generatedShape<n>(collisions get a numeric suffix).descriptions as//comments above declarations, properties, and function parameters. A property comment that merely repeats the referenced type's own comment is suppressed.Schema changes
signature.parametersis nowreadonly Parameter[]({ name, description?, schema }) instead of bareSchema[], so an argument's name and docs are known independently of its type.ToTypederives the call signature positionally fromparameter.schema.Schema.propertyMeta({ [key]: PropertyMeta },PropertyMeta { description? }) for per-property field docs that stay independent of a shared/by-reference property type. Pure metadata — does not affectToType, stripped from structural-shape identity.Parameter/PropertyMetaexported from@adobe/data/schema.Migration:
data-rpcruntime readers (register-service,synthesize-service) mapparameters → p.schema(helpers stay onSchema[]); all function-schema fixtures acrossdata,data-rpc,data-rpc-iframemigrated to named parameters.agentic-serviceactionparametersare a separate concept and unchanged.2.
@adobe/data-aiinstaller: write managed notice asAGENTS.mdby defaultThe installer dropped a
CLAUDE.md"do-not-edit" notice into both managed bundle folders (.claude/rules/adobe-data-ai/,.agents/skills/adobe-data-ai/). On Claude Code 2.1.286, anyCLAUDE.mdin the tree switches the project into CLAUDE.md mode and suppressesAGENTS.mddiscovery project-wide — so a repo migrating toAGENTS.md(e.g. to share instructions between Claude Code and Copilot) silently loses all instructions.Fix (
bin/cli.mjsnoticeFilename): name the notice for the repo's convention —AGENTS.mdby default (the cross-agent standard, also read by Claude Code),CLAUDE.mdonly for a repo that is still CLAUDE.md-only. AnAGENTS.mdrepo (or greenfield) never receives a data-aiCLAUDE.md. Bundle folders are wipe-and-recopied each install, so existing repos self-heal on their next install. Addstest/install.test.mjs(4 integration tests) and documents the behavior in the README.Testing
data-rpc48/48,dataschema + async-data-service 468/468.pnpm run lint+pnpm run typecheckclean (only pre-existingdist/assemblyartifact errors remain, unrelated).Related PRs
N/A