Skip to content

Commit 10a70eb

Browse files
chrisradeksrchase
authored andcommitted
Rest/XML serializer (#51)
* Adds XmlBodyBuilder for serializing XML bodies. * Adds REST Marhsaller/Unmarshaller.
1 parent 0f3087c commit 10a70eb

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

packages/types/src/marshaller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import {Member, OperationModel} from "./protocol";
1+
import {OperationModel} from "./protocol";
22
import {HttpRequest} from "./http";
33

44
export interface BodySerializer<SerializedType = string> {
55
/**
66
* Converts the provided `input` into the serialized format described in the
77
* provided `shape`.
88
*
9-
* @param shape The serialization model shape to which the input should be
9+
* @param operation The operation model to which the input should be
1010
* converted
1111
* @param input The value to convert
1212
*
1313
* @throws if a node in the input cannot be converted into the type
1414
* specified by the serialization model
1515
*/
16-
build(shape: Member, input: any): SerializedType;
16+
build(operation: OperationModel, input: any): SerializedType;
1717
}
1818

1919
export interface RequestSerializer<StreamType = Uint8Array> {

packages/types/src/protocol.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type SerializationType = 'blob'|'boolean'|'list'|'map'|'number'|'string'|'structure'|'timestamp';
1+
export type SerializationType = 'blob'|'boolean'|'float'|'integer'|'list'|'map'|'string'|'structure'|'timestamp';
22

33
export type MemberLocation = 'header'|'headers'|'uri'|'querystring'|'statusCode';
44

@@ -32,6 +32,16 @@ export interface Boolean extends Shape {
3232
type: 'boolean';
3333
}
3434

35+
export interface Float extends Shape {
36+
type: 'float';
37+
min?: number;
38+
}
39+
40+
export interface Integer extends Shape {
41+
type: 'integer';
42+
min?: number;
43+
}
44+
3545
export interface List extends Shape {
3646
type: 'list';
3747
member: Member;
@@ -47,7 +57,6 @@ export interface Map extends Shape {
4757
}
4858

4959
export interface Number extends Shape {
50-
type: 'number';
5160
min?: number;
5261
}
5362

@@ -72,7 +81,7 @@ export interface Timestamp extends Shape {
7281
timestampFormat?: string;
7382
}
7483

75-
export type SerializationModel = Blob|Boolean|List|Map|Number|String|Structure|Timestamp;
84+
export type SerializationModel = Blob|Boolean|Float|Integer|List|Map|String|Structure|Timestamp;
7685

7786
export interface HttpTrait {
7887
method: string;

0 commit comments

Comments
 (0)