-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into arm-lro-opt
- Loading branch information
Showing
6 changed files
with
210 additions
and
72 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.chronus/changes/autorest-emitt-all-programmatically-2024-5-7-9-28-38.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- "@azure-tools/typespec-autorest" | ||
--- | ||
|
||
Add API to programmatically get all the OpenAPI2 documents for all services at all versions in a spec |
Submodule core
updated
24 files
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import type { Service, SourceFile } from "@typespec/compiler"; | ||
import type { OpenAPI2Document } from "./openapi2-document.js"; | ||
|
||
/** | ||
* A record containing the the OpenAPI 3 documents corresponding to | ||
* a particular service definition. | ||
*/ | ||
export type AutorestServiceRecord = | ||
| AutorestUnversionedServiceRecord | ||
| AutorestVersionedServiceRecord; | ||
|
||
export interface AutorestUnversionedServiceRecord extends AutorestEmitterResult { | ||
/** The service that generated this OpenAPI document */ | ||
readonly service: Service; | ||
|
||
/** Whether the service is versioned */ | ||
readonly versioned: false; | ||
} | ||
|
||
export interface AutorestVersionedServiceRecord { | ||
/** The service that generated this OpenAPI document */ | ||
readonly service: Service; | ||
|
||
/** Whether the service is versioned */ | ||
readonly versioned: true; | ||
|
||
/** The OpenAPI 3 document records for each version of this service */ | ||
readonly versions: AutorestVersionedDocumentRecord[]; | ||
} | ||
|
||
/** | ||
* A record containing an unversioned OpenAPI document and associated metadata. | ||
*/ | ||
export interface AutorestVersionedDocumentRecord extends AutorestEmitterResult { | ||
/** The service that generated this OpenAPI document. */ | ||
readonly service: Service; | ||
|
||
/** The version of the service. Absent if the service is unversioned. */ | ||
readonly version: string; | ||
} | ||
|
||
export interface OperationExamples { | ||
readonly operationId: string; | ||
readonly examples: LoadedExample[]; | ||
} | ||
|
||
export interface AutorestEmitterResult { | ||
/** The OpenAPI document*/ | ||
readonly document: OpenAPI2Document; | ||
|
||
/** The examples */ | ||
readonly operationExamples: OperationExamples[]; | ||
|
||
/** Output file used */ | ||
readonly outputFile: string; | ||
} | ||
|
||
export interface LoadedExample { | ||
readonly relativePath: string; | ||
readonly file: SourceFile; | ||
readonly data: any; | ||
} |