-
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.
- Loading branch information
1 parent
a2c7560
commit 5a4f789
Showing
7 changed files
with
78 additions
and
21 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
.chronus/changes/autorest-generated-dec-sig-2024-6-18-11-30-47.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,6 @@ | ||
--- | ||
changeKind: internal | ||
packages: | ||
- "@azure-tools/typespec-autorest" | ||
--- | ||
|
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,29 @@ | ||
import type { DecoratorContext, Model, ModelProperty, Operation } from "@typespec/compiler"; | ||
|
||
/** | ||
* `@example` - attaches example files to an operation. Multiple examples can be specified. | ||
* | ||
* `@example` can be specified on Operations. | ||
* | ||
* @param pathOrUri path or Uri to the example file. | ||
* @param title name or description of the example file. | ||
*/ | ||
export type ExampleDecorator = ( | ||
context: DecoratorContext, | ||
target: Operation, | ||
pathOrUri: string, | ||
title: string | ||
) => void; | ||
|
||
/** | ||
* `@useRef` - is used to replace the TypeSpec model type in emitter output with a pre-existing named OpenAPI schema such as Azure Resource Manager common types. | ||
* | ||
* `@useRef` can be specified on Models and ModelProperty. | ||
* | ||
* @param jsonRef path or Uri to an OpenAPI schema. | ||
*/ | ||
export type UseRefDecorator = ( | ||
context: DecoratorContext, | ||
entity: Model | ModelProperty, | ||
jsonRef: string | ||
) => void; |
14 changes: 14 additions & 0 deletions
14
packages/typespec-autorest/generated-defs/Autorest.ts-test.ts
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,14 @@ | ||
/** An error here would mean that the decorator is not exported or doesn't have the right name. */ | ||
import { $example, $useRef } from "@azure-tools/typespec-autorest"; | ||
import type { ExampleDecorator, UseRefDecorator } from "./Autorest.js"; | ||
|
||
type Decorators = { | ||
$example: ExampleDecorator; | ||
$useRef: UseRefDecorator; | ||
}; | ||
|
||
/** An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ... */ | ||
const _: Decorators = { | ||
$example, | ||
$useRef, | ||
}; |
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