Allow @typespec/openapi3 to receive more than one file-type.#9890
Merged
timotheeguerin merged 6 commits intomainfrom Mar 4, 2026
Merged
Allow @typespec/openapi3 to receive more than one file-type.#9890timotheeguerin merged 6 commits intomainfrom
file-type.#9890timotheeguerin merged 6 commits intomainfrom
Conversation
commit: |
Contributor
Collaborator
|
You can try these changes here
|
timotheeguerin
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the OpenAPI emitter to support generating output files in multiple formats (YAML and JSON) simultaneously, rather than just one. It introduces the ability to specify an array of file types and updates the output file naming logic to accommodate this new feature. Comprehensive tests have been added to verify the correct behavior for various scenarios.
Multi-format output support
The
file-typeoption inOpenAPI3EmitterOptionscan now be a single value or an array, allowing emission of both YAML and JSON files in one run. The schema and documentation were updated accordingly. [1] [2] [3]The output file name logic now uses the
{file-type}variable when multiple formats are specified, ensuring distinct filenames for each format. The default value and documentation foroutput-filewere updated to reflect this. [1] [2]Emitter logic updates
The emitter now iterates over all specified file types, generating the appropriate output for each service and version. The logic for resolving output file names and serializing documents was updated to handle multiple formats. [1] [2]
The resolved emitter options and related interfaces were updated to use
fileTypes: FileType[]instead of a singlefileType.Testing