Compare commits
3 Commits
17f115d9c6
...
0a54b5a3de
Author | SHA1 | Date | |
---|---|---|---|
0a54b5a3de | |||
|
176817f95f | ||
d6b6331def |
|
@ -109,13 +109,18 @@ pub const TraitType = enum {
|
||||||
http_label,
|
http_label,
|
||||||
http_query,
|
http_query,
|
||||||
http_payload,
|
http_payload,
|
||||||
required,
|
json_name,
|
||||||
|
xml_name,
|
||||||
|
required, // required on the server
|
||||||
|
client_optional, // optional as far as the client is concerned
|
||||||
documentation,
|
documentation,
|
||||||
pattern,
|
pattern,
|
||||||
range,
|
range,
|
||||||
length,
|
length,
|
||||||
box,
|
box,
|
||||||
sparse,
|
sparse,
|
||||||
|
enum_value,
|
||||||
|
aws_query_error,
|
||||||
};
|
};
|
||||||
pub const Trait = union(TraitType) {
|
pub const Trait = union(TraitType) {
|
||||||
aws_api_service: struct {
|
aws_api_service: struct {
|
||||||
|
@ -142,6 +147,7 @@ pub const Trait = union(TraitType) {
|
||||||
http_query: []const u8,
|
http_query: []const u8,
|
||||||
http_payload: struct {},
|
http_payload: struct {},
|
||||||
required: struct {},
|
required: struct {},
|
||||||
|
client_optional: void,
|
||||||
documentation: []const u8,
|
documentation: []const u8,
|
||||||
pattern: []const u8,
|
pattern: []const u8,
|
||||||
range: struct { // most data is actually integers, but as some are floats, we'll use that here
|
range: struct { // most data is actually integers, but as some are floats, we'll use that here
|
||||||
|
@ -154,6 +160,11 @@ pub const Trait = union(TraitType) {
|
||||||
},
|
},
|
||||||
box: struct {},
|
box: struct {},
|
||||||
sparse: struct {},
|
sparse: struct {},
|
||||||
|
enum_value: []const u8,
|
||||||
|
aws_query_error: struct {
|
||||||
|
http_response_code: i64,
|
||||||
|
code: []const u8,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const ShapeType = enum {
|
const ShapeType = enum {
|
||||||
blob,
|
blob,
|
||||||
|
@ -645,6 +656,8 @@ fn getTrait(trait_type: []const u8, value: std.json.Value) SmithyParseError!?Tra
|
||||||
};
|
};
|
||||||
if (std.mem.eql(u8, trait_type, "smithy.api#required"))
|
if (std.mem.eql(u8, trait_type, "smithy.api#required"))
|
||||||
return Trait{ .required = .{} };
|
return Trait{ .required = .{} };
|
||||||
|
if (std.mem.eql(u8, trait_type, "smithy.api#clientOptional"))
|
||||||
|
return Trait{ .client_optional = {} };
|
||||||
if (std.mem.eql(u8, trait_type, "smithy.api#sparse"))
|
if (std.mem.eql(u8, trait_type, "smithy.api#sparse"))
|
||||||
return Trait{ .sparse = .{} };
|
return Trait{ .sparse = .{} };
|
||||||
if (std.mem.eql(u8, trait_type, "smithy.api#box"))
|
if (std.mem.eql(u8, trait_type, "smithy.api#box"))
|
||||||
|
@ -709,6 +722,14 @@ fn getTrait(trait_type: []const u8, value: std.json.Value) SmithyParseError!?Tra
|
||||||
.code = code,
|
.code = code,
|
||||||
} };
|
} };
|
||||||
}
|
}
|
||||||
|
if (std.mem.eql(u8, trait_type, "aws.protocols#awsQueryError")) {
|
||||||
|
return Trait{
|
||||||
|
.aws_query_error = .{
|
||||||
|
.code = value.object.get("code").?.string, // code is required
|
||||||
|
.http_response_code = value.object.get("httpResponseCode").?.integer,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
if (std.mem.eql(u8, trait_type, "smithy.api#jsonName"))
|
if (std.mem.eql(u8, trait_type, "smithy.api#jsonName"))
|
||||||
return Trait{ .json_name = value.string };
|
return Trait{ .json_name = value.string };
|
||||||
if (std.mem.eql(u8, trait_type, "smithy.api#xmlName"))
|
if (std.mem.eql(u8, trait_type, "smithy.api#xmlName"))
|
||||||
|
@ -726,6 +747,10 @@ fn getTrait(trait_type: []const u8, value: std.json.Value) SmithyParseError!?Tra
|
||||||
|
|
||||||
if (std.mem.eql(u8, trait_type, "smithy.api#xmlNamespace"))
|
if (std.mem.eql(u8, trait_type, "smithy.api#xmlNamespace"))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (std.mem.eql(u8, trait_type, "smithy.api#enumValue"))
|
||||||
|
return Trait{ .enum_value = value.string };
|
||||||
|
|
||||||
// TODO: win argument with compiler to get this comptime
|
// TODO: win argument with compiler to get this comptime
|
||||||
const list =
|
const list =
|
||||||
\\aws.api#arnReference
|
\\aws.api#arnReference
|
||||||
|
|
Loading…
Reference in New Issue
Block a user