Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Specs can fail to load examples when compiled from outside spec folder #1173

Closed
4 tasks done
timotheeguerin opened this issue Jul 16, 2024 · 2 comments · Fixed by #1368
Closed
4 tasks done
Assignees
Labels
deprecation A previously supported feature will now report a warning and eventually be removed emitter:autorest Issues for @azure-tools/typespec-autorest emitter feature New feature or request

Comments

@timotheeguerin
Copy link
Member

Describe the bug

Specs can fail to load examples when compiled from outside the spec folder (e.g. tsp compile path/to/spec), but succeed when compiled from inside the spec folder (e.g. cd path/to/spec; tsp compile .).

Related: microsoft/typespec#2241, https://github.com/Azure/typespec-azure-pr/issues/3182

Reproduction

$ gh repo clone azure/azure-rest-api-specs
$ cd azure-rest-api-specs
$ npm ci

$ npx tsp compile specification/oracle/Oracle.Database.Management
warning @azure-tools/typespec-autorest/example-loading: Skipping example loading from examples/2023-09-01-preview because there was an error reading the directory.

$ cd specification/oracle/Oracle.Database.Management
$ npx tsp compile .
<no warning>

Checklist

@markcowl
Copy link
Member

est: 5

@markcowl markcowl added this to the [2024] September milestone Jul 23, 2024
@markcowl markcowl added the emitter:autorest Issues for @azure-tools/typespec-autorest emitter label Jul 23, 2024
@markcowl markcowl added feature New feature or request needs-area and removed needs-area labels Jul 23, 2024
@timotheeguerin timotheeguerin self-assigned this Aug 13, 2024
@timotheeguerin timotheeguerin added deprecation A previously supported feature will now report a warning and eventually be removed and removed breaking-change A change that might cause specs or code to break labels Aug 13, 2024
@markcowl
Copy link
Member

markcowl commented Sep 4, 2024

Describe the breaking change
Many specs in azure-rest-api-specs configure a relative path to examples, which prevents compilation outside the spec directory. Adds a new setting that enforces absolute path, deprecates the old setting and adds a default so that no setting is required in most cases.

Back-compat design to avoid immediate breaking
Existing setting is deprecated and a default is added, so the setting will not be required for most specs going forward.

All existing specs are corrected.

Impact
This change affecting:

  • ARM
  • Data-plane
  • Existing specs: approx. # of service/spec impacted: ~30
  • New specs
  • Emitters
  • SDK

Targeted Sprint
Sprint:

Additional information
Requested by the engineering team

github-merge-queue bot pushed a commit that referenced this issue Sep 6, 2024
markcowl added a commit to markcowl/typespec-azure that referenced this issue Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation A previously supported feature will now report a warning and eventually be removed emitter:autorest Issues for @azure-tools/typespec-autorest emitter feature New feature or request
Projects
None yet
2 participants