Skip to content

Add option to remove unnecessary sample copying in typespec-autorest#4190

Merged
markcowl merged 20 commits into
mainfrom
copilot/add-emitter-option-skip-example-copying
Jun 2, 2026
Merged

Add option to remove unnecessary sample copying in typespec-autorest#4190
markcowl merged 20 commits into
mainfrom
copilot/add-emitter-option-skip-example-copying

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

Adds a new config option for typespec-autorest skip-example-copying that allows example files to remain in the directory where they are created, rather than duplicating them on compile.

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: cc12579

@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
Copilot AI and others added 2 commits May 30, 2026 01:41
…ption-skip-example-copying

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
… intro + output-file setting)

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

Copilot AI commented May 30, 2026

@copilot Please pull the latest from main, make the suggested changes, ensure that all files are formatted correctly and only changes associated with this PR are in the pr diff.

Applied both suggested doc changes and pulled latest from main in e5c17b3. PR diff contains only PR-related files, formatting is clean.

Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Copilot AI changed the title feat(typespec-autorest): add skip-example-copying emitter option and examples-dir version interpolation Simplify resolveExampleDir interpolation check to just {version} Jun 1, 2026
@markcowl markcowl changed the title Simplify resolveExampleDir interpolation check to just {version} Add option to remove unnecessary sample copying in typespec-autorest Jun 1, 2026
Copy link
Copy Markdown
Member

@catalinaperalta catalinaperalta left a comment

Choose a reason for hiding this comment

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

love this feature :)

@markcowl markcowl added this pull request to the merge queue Jun 2, 2026
Merged via the queue into main with commit e4943e3 Jun 2, 2026
26 of 27 checks passed
@markcowl markcowl deleted the copilot/add-emitter-option-skip-example-copying branch June 2, 2026 01:05
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 eng 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.

5 participants