-
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.
[Language Text] Mitigating bug in auto detected language for TA4H (#2…
…3720) It adds a swagger transform to specify the type of `detectedLanguage` to be a string and then attempts to deserialize it in the convenience layer and set the iso name correctly.
- Loading branch information
1 parent
77edd2d
commit 5c6bff2
Showing
6 changed files
with
103 additions
and
31 deletions.
There are no files selected for viewing
12 changes: 8 additions & 4 deletions
12
sdk/cognitivelanguage/ai-language-text/src/generated/models/index.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 26 additions & 11 deletions
37
sdk/cognitivelanguage/ai-language-text/src/generated/models/mappers.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
22 changes: 22 additions & 0 deletions
22
sdk/cognitivelanguage/ai-language-text/test/internal/utils.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,22 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import { assert } from "@azure/test-utils"; | ||
import { deserializeDetectedLanguage } from "../../src/transforms"; | ||
|
||
describe("Utilities", function () { | ||
describe("deserializeDetectedLanguage", function () { | ||
it("deserializes string", function () { | ||
assert.deepEqual(deserializeDetectedLanguage("en"), { iso6391Name: "en" } as any); | ||
}); | ||
|
||
it("deserializes object", function () { | ||
const res = { | ||
name: "English", | ||
iso6391Name: "en", | ||
confidenceScore: 0.98, | ||
}; | ||
assert.deepEqual(deserializeDetectedLanguage(JSON.stringify(res)), res); | ||
}); | ||
}); | ||
}); |
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