Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/core/core-client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### Other Changes

- Removed the constraints check during serialization. Please refer [#21839](https://github.com/Azure/azure-sdk-for-js/issues/21839) for further details.

## 1.6.0 (2022-05-05)

### Features Added
Expand Down
1 change: 1 addition & 0 deletions sdk/core/core-client/review/core-client.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export interface Serializer {
[key: string]: any;
};
serialize(mapper: Mapper, object: any, objectName?: string, options?: SerializerOptions): any;
// @deprecated
validateConstraints(mapper: Mapper, value: any, objectName: string): void;
}

Expand Down
1 change: 1 addition & 0 deletions sdk/core/core-client/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ export interface Serializer {
* @param mapper - The definition of data models.
* @param value - The value.
* @param objectName - Name of the object. Used in the error messages.
* @deprecated Removing the constraints validation on client side.
*/
validateConstraints(mapper: Mapper, value: any, objectName: string): void;

Expand Down
5 changes: 3 additions & 2 deletions sdk/core/core-client/src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class SerializerImpl implements Serializer {
public readonly isXML: boolean = false
) {}

/**
* @deprecated Removing the constraints validation on client side.
*/
validateConstraints(mapper: Mapper, value: any, objectName: string): void {
const failValidation = (
constraintName: keyof MapperConstraints,
Expand Down Expand Up @@ -154,8 +157,6 @@ class SerializerImpl implements Serializer {
if (object === undefined || object === null) {
payload = object;
} else {
// Validate Constraints if any
this.validateConstraints(mapper, object, objectName);
if (mapperType.match(/^any$/i) !== null) {
payload = object;
} else if (mapperType.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/i) !== null) {
Expand Down
2 changes: 2 additions & 0 deletions sdk/core/core-http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### Other Changes

- Removed the constraints check during serialization. Please refer [#21839](https://github.com/Azure/azure-sdk-for-js/issues/21839) for further details.

## 2.2.5 (2022-05-05)

### Bugs Fixed
Expand Down
1 change: 1 addition & 0 deletions sdk/core/core-http/review/core-http.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ export class Serializer {
[key: string]: any;
};
serialize(mapper: Mapper, object: unknown, objectName?: string, options?: SerializerOptions): any;
// @deprecated
validateConstraints(mapper: Mapper, value: unknown, objectName: string): void;
}

Expand Down
3 changes: 1 addition & 2 deletions sdk/core/core-http/src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class Serializer {
* @param mapper - The definition of data models.
* @param value - The value.
* @param objectName - Name of the object. Used in the error messages.
* @deprecated Removing the constraints validation on client side.
*/
validateConstraints(mapper: Mapper, value: unknown, objectName: string): void {
const failValidation = (
Expand Down Expand Up @@ -156,8 +157,6 @@ export class Serializer {
if (object == undefined) {
payload = object;
} else {
// Validate Constraints if any
this.validateConstraints(mapper, object, objectName);
if (mapperType.match(/^any$/i) !== null) {
payload = object;
} else if (mapperType.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/i) !== null) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-http/src/util/xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function parseXML(str: string, opts: SerializerOptions = {}): Promise<any
if (!str) {
reject(new Error("Document is empty"));
} else {
xmlParser.parseString(str, (err, res) => {
xmlParser.parseString(str, (err: any, res: any) => {
if (err) {
reject(err);
} else {
Expand Down