Preserve typed service names and paths in one schema - #107
Merged
Conversation
KidkArolis
force-pushed
the
codex/preserve-service-path-types
branch
from
August 26, 2026 20:26
50e2ee5 to
36405e8
Compare
KidkArolis
marked this pull request as ready for review
August 26, 2026 21:09
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.
What changed
Serviceservice<T>()return an unbound declaration whose path defaults to its eventual schema keyservice<T>().at('api/path')for handwritten aliases without repeating the path in a generic and a valueservice.from<ApiSchemaTypes>()for generated, path-keyed service catalogs, where the selected path determines both the runtime path and service contractcreateSchema()the sole materialization boundary and reject empty or duplicate transport pathsServiceByName,ServiceByPath, andServiceDefinitionByPathutilities instead of an ambiguous name-or-path lookupuseFeathers()return the actual underlying client with path-derived types, without a pass-through proxyAPI
Handwritten schemas:
Generated path catalogs:
The object key supplies the Figbird name. The explicit path or catalog selection supplies the transport path.
createSchema()produces one materialized schema carrying both.Why
Applications migrating gradually to named Figbird APIs should not need a parallel "legacy schema" for path-based hooks. The previous PR iteration preserved paths, but declaring one required repeating the same literal in a generic and at runtime, and the generic
ServiceByIdentifierutility became ambiguous when the name and path namespaces overlapped.This version makes the two namespaces first-class and deliberately separate while keeping a single source of service types. It also gives schema generators a compact, checked API: unknown catalog paths fail at compile time and automatically select the matching backend contract.
Validation
npm run tscnpm run lintnpm run buildnpx ava test/type-inference.test.ts test/schema.test.tsx— 12 tests passednpm test— type-checking, lint, formatting, coverage, and all 359 tests passed