-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KeyVault] - Regenerate from 7.2 stable swagger (#14964)
This PR includes regenerated code from the stable 7.2 swagger. Up until now it was in preview, but now that it's stable we're regenerating (and expected no meaningful changes). But there were meaningful changes! Recently our code generator started emitting `null` based on the x-nullable spec which unfortunately expanded CertificateOperation.error and ErrorModel.innerError to be `ErrorModel | undefined | **null**` Since this data is going from server to client we can only narrow it, we can't expand it without a breaking change. This is made worse because we re-exported ErrorModel as-is in 4.1. I looked into it and realized that this is done for historical reasons and not semantically meaningful see: Azure/azure-rest-api-specs#10262 (comment). So I am deprecating `ErrorModel` since we should use the `CertificateOperationError` type anyway, ensuring that the existing ErrorModel does not change, and applying the transformation from null to undefined in the convenience layer to keep the API the same.
- Loading branch information
Showing
17 changed files
with
133 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
47 changes: 47 additions & 0 deletions
47
sdk/keyvault/keyvault-certificates/test/internal/transformations.spec.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,47 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import { assert } from "chai"; | ||
import { CertificateOperation as CoreCertificateOperation } from "../../src/generated/models"; | ||
import { getCertificateOperationFromCoreOperation } from "../../src/transformations"; | ||
|
||
describe("transformations", function() { | ||
describe("getCertificateOperationFromCoreOperation", function() { | ||
it("transforms null error to undefined", function() { | ||
const input: CoreCertificateOperation = { | ||
error: null | ||
}; | ||
|
||
assert.isUndefined(getCertificateOperationFromCoreOperation("", "", input).error); | ||
}); | ||
|
||
it("transforms null inner error to undefined", function() { | ||
const input: CoreCertificateOperation = { | ||
error: { | ||
innerError: null | ||
} | ||
}; | ||
|
||
const output = getCertificateOperationFromCoreOperation("", "", input); | ||
assert.isDefined(output.error); | ||
assert.isUndefined(output.error!.innerError); | ||
}); | ||
|
||
it("transforms errors correctly when present", function() { | ||
const input: CoreCertificateOperation = { | ||
error: { | ||
code: "outer error", | ||
message: "The outer error message", | ||
innerError: { | ||
code: "inner error", | ||
innerError: undefined, | ||
message: "The inner error message" | ||
} | ||
} | ||
}; | ||
|
||
const output = getCertificateOperationFromCoreOperation("", "", input); | ||
assert.deepNestedInclude(output, input); | ||
}); | ||
}); | ||
}); |
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
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.