feat(typespec-go): emit apiview-properties.json with cross-language definition IDs - #5112
feat(typespec-go): emit apiview-properties.json with cross-language definition IDs#5112Chenjie Shi (tadelesh) wants to merge 8 commits into
Conversation
…efinition IDs Emits `testdata/apiview-properties.json` mapping the line IDs produced by the Go APIView parser to their TCGC `crossLanguageDefinitionId`, so APIView can link the Go API surface to the other languages. Covered symbols: models (incl. polymorphic), enums, enum values, clients, client constructors, the ARM `ClientFactory` accessors, and client methods. The file also carries `CrossLanguagePackageId` and `CrossLanguageVersion`. Fixes #4931 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2fed377-7b26-45fc-b3aa-8b6d6df8b46a
|
All changed packages have been documented.
Show changes
|
Go emitter diffBaseline Diff summary: 112 file(s), +3270 / -0 Rendered diff: inline on the run summary, or the emitter-diff-go-html artifact. Informational check (core/eng/emitter-diff); does not block the PR. |
commit: |
|
You can try these changes here
|
- emit apiview-properties.json for ContainingModule roots as well - add azblob to the cspell word list Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2fed377-7b26-45fc-b3aa-8b6d6df8b46a
Compute the full package path relative to the existing module's go.mod so root and nested package IDs match the Go APIView parser. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2fed377-7b26-45fc-b3aa-8b6d6df8b46a
|
Fixed containing-module LineID qualification in c680046. The emitter now derives the complete package path from |
Keep using the output directory name when the containing module root is unavailable or does not contain the output path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2fed377-7b26-45fc-b3aa-8b6d6df8b46a
|
Adjusted in d4c3bc5: removed the new containing-module validation. The full path is used when the nearest |
Keep filesystem path resolution out of the TCGC adapter and apply it after code model construction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2fed377-7b26-45fc-b3aa-8b6d6df8b46a
|
Refactored in c2b648a. |
Include ClientFactory, NewClientFactory, and verify each New<Client> accessor in APIView cross-language metadata. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2fed377-7b26-45fc-b3aa-8b6d6df8b46a
|
Added the missing ARM factory symbols in 5dea213: |
Require TCGC package metadata and pass containing-module paths directly to APIView generation instead of storing filesystem state in the Go code model. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2fed377-7b26-45fc-b3aa-8b6d6df8b46a
Resolve TypeSpec Go emitter refactors while retaining APIView metadata generation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 686715d2-367d-4fd7-a242-3e003b6b796c
📦 Package size report✅ No notable package size changes compared to the base branch. 13 package(s) with no notable change
Packed = gzipped |
Fixes #4931
What
The Go emitter now writes
testdata/apiview-properties.jsonalongsidetestdata/_metadata.json. It maps the Go APIView parser's line IDs for generated models, enums, enum values, clients, client factories, constructors, and methods to their TCGCcrossLanguageDefinitionIdvalues.Line IDs
Keys match
src/go/cmd/token_makers.go:<rel>.<Name><rel>-<FunctionName><rel>-(<receiver> <receiverType>) <MethodName><rel>is the package path relative to the module root, with a/vNmodule suffix removed. Forcontaining-module, the emitter uses the nearestgo.modto compute the complete relative path. If the module root is unavailable or does not contain the output path, it falls back to the output directory name.Method names use
fixUpMethodName, so LRO and pageable methods match their generatedBegin<Name>andNew<Name>Pagernames. Only exported symbols are included.Implementation
crossLanguageDefinitionIdfrom TCGC through the Go code model and carriescrossLanguageVersiononInfo.ClientFactory,NewClientFactory, and everyNew<Client>accessor.Notes
The APIView side is tracked by Azure/azure-sdk-tools#4282. This PR supplies the emitter metadata it will consume.
Validation
containing-modulepathscontainingmod/v2fixture generates APIView IDs prefixed withcontainingmod/subpkg