feat(typespec-autorest): add skip-example-copying emitter option#4190
feat(typespec-autorest): add skip-example-copying emitter option#4190
skip-example-copying emitter option#4190Conversation
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>
markcowl
left a comment
There was a problem hiding this comment.
- 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
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/774e6722-332b-4c31-acf6-e8363ef4a705 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Added in 9e3df9b:
All 468 tests pass, files are formatted, and branch is up to date with main. |
|
/azp run typespec-azure - PR Tools |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
All changed packages have been documented.
Show changes
|
commit: |
|
You can try these changes here
|
|
@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) |
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>
Branch is up to date with main (no merge issues). Fixed the formatting issue in |
|
@copilot Please update the tsp init feeds for Azure (ARM and data-plane) located in /eng/feeds to use this setting by default, rebuild the feeds and ensure that tests pass. Also update this document: https://azure.github.io/typespec-azure/docs/migrate-swagger/faq/x-ms-examples/ to recommend using the new setting and set the examples directory appropriately (provide a valid example). Pull the latest from main, ensure no merge issues, only your changes are in the PR, and that all files are formatted correctly and all tests pass. |
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/0e356775-70e8-49d6-92a6-ec924dcbba65 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/0e356775-70e8-49d6-92a6-ec924dcbba65 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
|
… snapshots Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/6bb7e57d-bb20-4569-9e32-5ca3f5245044 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
| emitter-output-dir: "{project-root}" | ||
| output-file: "{emitter-output-dir}/{version-status}/{version}/widget.json" | ||
| arm-types-dir: "{project-root}/../../../../common-types/resource-management" | ||
| examples-dir: "{project-root}/examples" |
There was a problem hiding this comment.
I am thinking we don't copy into the swagger directory.
There was a problem hiding this comment.
so they would be at examples/<version>/
There was a problem hiding this comment.
But this is assuming that we have logical example checks in ci, if we are forcing them to be at a particular location, then we should conform. It's worth checking.
There was a problem hiding this comment.
I think there is 2 issues with that:
- Oav will generate I think in the wrong location so you'd still need to copy back
- That will cause all refs to be udpated in the seagger when we migrate no?
…ption-skip-example-copying Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
… yet published to npm) Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/4aa2af3a-33fe-420d-854d-94d8c9a8345c Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Pulled latest from main and fixed the e2e test failures in |

skip-example-copyingboolean option toAutorestEmitterOptionsinterface and JSON schemaskipExampleCopyingtoAutorestDocumentEmitterOptionsskipExampleCopyingthrough inresolveAutorestOptions$refgeneration to use relative source path when skip-example-copying is enabledskip-example-copyingandexamples-direxamples-dironly (skip-example-copying not yet in published npm package)