-
Notifications
You must be signed in to change notification settings - Fork 51
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' of https://github.com/Azure/typespec-azure into d…
…ependabot/submodules/core-1edb744
- Loading branch information
Showing
20 changed files
with
587 additions
and
294 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
.chronus/changes/change-workspace-ranges-2025-2-6-10-4-22.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,14 @@ | ||
--- | ||
changeKind: internal | ||
packages: | ||
- "@azure-tools/azure-http-specs" | ||
- "@azure-tools/typespec-autorest-canonical" | ||
- "@azure-tools/typespec-autorest" | ||
- "@azure-tools/typespec-azure-core" | ||
- "@azure-tools/typespec-azure-portal-core" | ||
- "@azure-tools/typespec-azure-resource-manager" | ||
- "@azure-tools/typespec-azure-rulesets" | ||
- "@azure-tools/typespec-client-generator-core" | ||
--- | ||
|
||
Updates pinning of workspace dependencies to ^ from ~ |
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,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: feature | ||
packages: | ||
- "@azure-tools/azure-http-specs" | ||
--- | ||
|
||
azure-http-specs, add ARM Exception test case |
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
162 changes: 162 additions & 0 deletions
162
packages/azure-http-specs/specs/azure/resource-manager/common-properties/error.tsp
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,162 @@ | ||
import "@typespec/http"; | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/spector"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.ResourceManager; | ||
using TypeSpec.OpenAPI; | ||
using Spector; | ||
|
||
namespace Azure.ResourceManager.CommonProperties; | ||
|
||
@resource("confidentialResources") | ||
model ConfidentialResource is TrackedResource<ConfidentialResourceProperties> { | ||
...ResourceNameParameter<ConfidentialResource>; | ||
} | ||
|
||
@doc("Confidential Resource Properties.") | ||
model ConfidentialResourceProperties { | ||
@visibility(Lifecycle.Read) | ||
@doc("The status of the last operation.") | ||
provisioningState: string; | ||
|
||
username: string; | ||
} | ||
|
||
/** | ||
* Api error. | ||
*/ | ||
model ApiError { | ||
/** | ||
* The Api error details | ||
*/ | ||
details?: ApiErrorBase[]; | ||
|
||
/** | ||
* The Api inner error | ||
*/ | ||
innererror?: InnerError; | ||
|
||
/** | ||
* The error code. | ||
*/ | ||
code?: string; | ||
|
||
/** | ||
* The target of the particular error. | ||
*/ | ||
target?: string; | ||
|
||
/** | ||
* The error message. | ||
*/ | ||
message?: string; | ||
} | ||
|
||
/** | ||
* Api error base. | ||
*/ | ||
model ApiErrorBase { | ||
/** | ||
* The error code. | ||
*/ | ||
code?: string; | ||
|
||
/** | ||
* The target of the particular error. | ||
*/ | ||
target?: string; | ||
|
||
/** | ||
* The error message. | ||
*/ | ||
message?: string; | ||
} | ||
|
||
/** | ||
* Inner error details. | ||
*/ | ||
model InnerError { | ||
/** | ||
* The exception type. | ||
*/ | ||
exceptiontype?: string; | ||
|
||
/** | ||
* The internal error message or exception dump. | ||
*/ | ||
errordetail?: string; | ||
} | ||
|
||
/** | ||
* An error response. | ||
*/ | ||
@error | ||
model CloudError { | ||
/** | ||
* Api error. | ||
*/ | ||
error?: ApiError; | ||
} | ||
|
||
@armResourceOperations | ||
interface Error { | ||
@scenario | ||
@scenarioDoc(""" | ||
Resource GET operation. | ||
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/confidentialResources/confidential", | ||
Expected query parameter: api-version=2023-12-01-preview | ||
Expected response status code: 404 | ||
Expected response body: | ||
```json | ||
{ | ||
"error": { | ||
"code": "ResourceNotFound", | ||
"message": "The Resource 'Azure.ResourceManager.CommonProperties/confidentialResources/confidential' under resource group 'test-rg' was not found." | ||
} | ||
} | ||
``` | ||
""") | ||
getForPredefinedError is ArmResourceRead<ConfidentialResource>; | ||
|
||
@scenario | ||
@scenarioDoc(""" | ||
Resource PUT operation. | ||
Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/confidentialResources/confidential", | ||
Expected query parameter: api-version=2023-12-01-preview | ||
Expected request body: | ||
```json | ||
{ | ||
"location": <any string>, | ||
"properties": { | ||
"username": "00" | ||
} | ||
} | ||
``` | ||
Expected response status code: 400 | ||
Expected response body: | ||
```json | ||
{ | ||
"error": { | ||
"code": "BadRequest", | ||
"message": "Username should not contain only numbers.", | ||
"innererror": { | ||
"exceptiontype": "general" | ||
} | ||
} | ||
} | ||
``` | ||
""") | ||
createForUserDefinedError is ArmResourceCreateOrReplaceSync< | ||
ConfidentialResource, | ||
Error = CloudError | ||
>; | ||
} |
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
Oops, something went wrong.