Skip to content

Commit 53d8e94

Browse files
authored
Merge pull request #84 from shakilsiraj/feature/ignore-name-check
updated type definition
2 parents 1b2ac72 + 332d5fa commit 53d8e94

File tree

2 files changed

+46
-34
lines changed

2 files changed

+46
-34
lines changed

dist/ObjectMapper.d.ts

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-
21
/**
32
* Decorator metadata definition for JsonProperty
43
*/
54
export interface JsonPropertyDecoratorMetadata {
6-
name?: string, //name of the JSON property to map
7-
required?: boolean, //is this field required in the JSON object that is being deserialized
8-
access?: AccessType, //is this serializable and de-serializable
9-
type?: any //the type of Object that should be assigned to this property
10-
serializer?: any, //Serializer for the type
11-
deserializer?: any // deserializer for the type
5+
name?: string; //name of the JSON property to map
6+
required?: boolean; //is this field required in the JSON object that is being deserialized
7+
access?: AccessType; //is this serializable and de-serializable
8+
type?: any; //the type of Object that should be assigned to this property
9+
serializer?: any; //Serializer for the type
10+
deserializer?: any; // deserializer for the type
1211
}
1312

1413
export enum AccessType {
15-
READ_ONLY, WRITE_ONLY, BOTH
14+
READ_ONLY,
15+
WRITE_ONLY,
16+
BOTH,
1617
}
1718

18-
export interface Serializer{
19-
serialize(value: any): any;
19+
export interface Serializer {
20+
serialize(value: any): any;
2021
}
2122

22-
export interface Deserializer{
23-
deserialize(value: any): any;
23+
export interface Deserializer {
24+
deserialize(value: any): any;
2425
}
2526

2627
/**
2728
* JsonProperty Decorator function.
2829
*/
29-
export declare function JsonProperty(metadata?: JsonPropertyDecoratorMetadata): any;
30+
export declare function JsonProperty(
31+
metadata?: JsonPropertyDecoratorMetadata
32+
): any;
3033

3134
/**
3235
* Decorator for specifying cache key.
3336
* Used for Serializer/Deserializer caching.
34-
*
37+
*
3538
* @export
36-
* @param {string} key
37-
* @returns
39+
* @param {string} key
40+
* @returns
3841
*/
3942
export function CacheKey(key: string): Function;
4043

@@ -48,32 +51,41 @@ export declare function JsonIgnore(): any;
4851
*/
4952
export declare function JsonConverstionError(message: string, json: any): Error;
5053

51-
export declare namespace ObjectMapper {
54+
export interface DeserializationConfig {
55+
ignoreNameMetadata: boolean;
56+
}
5257

53-
/**
54-
* Deserializes a Object type with the passed on JSON data.
55-
*/
56-
export function deserialize<T>(type: { new (): T }, json: Object): T;
58+
export declare namespace ObjectMapper {
59+
/**
60+
* Deserializes a Object type with the passed on JSON data.
61+
*/
62+
export function deserialize<T>(
63+
type: { new (): T },
64+
json: Object,
65+
config?: DeserializationConfig
66+
): T;
5767

58-
/**
59-
* Deserializes an array of object types with the passed on JSON data.
60-
*/
61-
export function deserializeArray<T>(type: { new (): T }, json: Object): T[];
68+
/**
69+
* Deserializes an array of object types with the passed on JSON data.
70+
*/
71+
export function deserializeArray<T>(
72+
type: { new (): T },
73+
json: Object,
74+
config?: DeserializationConfig
75+
): T[];
6276

63-
/**
64-
* Serializes an object instance to JSON string.
65-
*/
66-
export function serialize(obj: any): String;
67-
77+
/**
78+
* Serializes an object instance to JSON string.
79+
*/
80+
export function serialize(obj: any): String;
6881
}
6982

7083
/**
7184
* Default Date serializer implementation.
72-
*
85+
*
7386
* @class DateSerializer
7487
* @implements {Serializer}
7588
*/
7689
export declare class DateSerializer implements Serializer {
77-
public serialize(value: Date): number;
90+
public serialize(value: Date): number;
7891
}
79-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-object-mapper",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"description": "A TypeScript library to serialize and deserialize JSON objects in a fast and non-recursive way",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)