Skip to content

Validate DocumentIdentifier arguments in API - #64079

Merged
Andrew Branch (andrewbranch) merged 2 commits into
mainfrom
copilot/fix-invalid-documentidentifier-typeerror
Aug 28, 2026
Merged

Validate DocumentIdentifier arguments in API#64079
Andrew Branch (andrewbranch) merged 2 commits into
mainfrom
copilot/fix-invalid-documentidentifier-typeerror

Conversation

Copilot AI commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Invalid DocumentIdentifier objects produced an internal path.js error instead of identifying the malformed argument.

Changes

  • Validate identifiers in resolveFileName and report their received shape.
  • Accept DocumentIdentifier consistently in transpile-from-file and source-file metadata APIs.
  • Cover invalid objects and URI identifiers in sync and async API tests.
Expected a string or { uri } for the document, received an object with keys: fileName

Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TypeError from path.js for invalid DocumentIdentifier Validate DocumentIdentifier arguments in API Aug 28, 2026
@andrewbranch
Andrew Branch (andrewbranch) marked this pull request as ready for review August 28, 2026 19:22
Copilot AI balanced review requested due to automatic review settings August 28, 2026 19:22

Copilot AI left a comment

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.

Pull request overview

Adds clear runtime validation for malformed DocumentIdentifier values and expands URI support across file-based APIs.

Changes:

  • Validate identifier shape in resolveFileName.
  • Accept URI identifiers in transpilation and metadata APIs.
  • Add synchronous and asynchronous regression coverage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/typescript/src/api/proto.ts Adds identifier validation and descriptive errors.
packages/typescript/src/api/async/api.ts Adds URI support to file-based async APIs.
packages/typescript/src/api/sync/api.ts Mirrors async API changes in generated sync APIs.
packages/typescript/test/async/api.test.ts Tests async validation and URI handling.
packages/typescript/test/sync/api.test.ts Mirrors coverage for synchronous APIs.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@andrewbranch
Andrew Branch (andrewbranch) added this pull request to the merge queue Aug 28, 2026
Merged via the queue into main with commit 28a4d6c Aug 28, 2026
26 checks passed
@andrewbranch
Andrew Branch (andrewbranch) deleted the copilot/fix-invalid-documentidentifier-typeerror branch August 28, 2026 20:11
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.

[API] An invalid DocumentIdentifier fails with a TypeError from path.js rather than a message naming the argument

4 participants