-
Notifications
You must be signed in to change notification settings - Fork 244
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
Fix bug: Unable to use {service-name} interpolation for filenames with openapi3-emitter when only one service is defined #6182
base: main
Are you sure you want to change the base?
Conversation
All changed packages have been documented.
Show changes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR fixes the bug where using the {service-name} interpolation for filenames with the openapi3-emitter fails when only one service is defined. The changes split the interpolation into two variables ("service-name" and "service-name-if-multiple") and update the output file patterns, documentation, and tests accordingly.
- Created a changelog file documenting the fix.
- Updated emitter configuration and interpolation logic in the source code.
- Modified tests and documentation to reflect the new interpolation behavior.
Reviewed Changes
File | Description |
---|---|
.chronus/changes/wanl-service-name-2025-1-27-19-40-32.md | Changelog entry for the bug fix. |
packages/openapi3/test/test-host.ts | Updated YAML parsing import and introduced new EmitterOptions usage. |
packages/openapi3/src/openapi.ts | Adjusted output file interpolation with separate keys for service names. |
packages/openapi3/test/works-for.ts | Extended test helpers to include new emitOpenApi API and interpolation. |
website/src/content/docs/docs/emitters/openapi3/reference/emitter.md | Revised documentation for the output file interpolation keys. |
packages/openapi3/test/emit-openapi.test.ts | Added tests to validate expected file naming with single and multiple services. |
packages/openapi3/src/lib.ts | Updated emitter option schema and documentation to reflect new defaults. |
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
packages/openapi3/src/openapi.ts:203
- Ensure that the change in the default output file template using
{service-name-if-multiple}
is intentional and clearly documented so that users understand the intended substitution behavior for single versus multiple services.
resolvedOptions["output-file"] ?? `openapi.{service-name-if-multiple}.{version}.${fileType}`;
packages/openapi3/test/emit-openapi.test.ts:109
- For the test case using the
{service-name-if-multiple}
pattern with one service, the expected output becomes just 'yaml', which might indicate that no service name is interpolated. Please verify that this behavior is intentional and consistent with the overall design.
expectedOutputFiles: [resolveVirtualPath("yaml")],
Head branch was pushed to by a user without write access
You can try these changes here
|
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you verify if the azure spec repo need to change here, I do see quite a lot using {service-name}
right now
Fix: #5866