switch field names to snake_case

This commit is contained in:
Emil Lerch 2021-06-03 17:39:38 -07:00
parent c2710be165
commit 329d732cd5
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -122,15 +122,16 @@ fn generateServices(ally_no_op: *std.mem.Allocator, comptime terminator: []const
_ = try writer.write("} = .{}" ++ terminator ++ " // end of service: "); _ = try writer.write("} = .{}" ++ terminator ++ " // end of service: ");
try writer.print("{s}\n", .{arn_namespace}); // this var needs to match above try writer.print("{s}\n", .{arn_namespace}); // this var needs to match above
} }
return constant_names.toOwnedSlice();
} }
fn generateOperation(allocator: *std.mem.Allocator, operation: smithy.ShapeInfo, shapes: anytype, writer: anytype) !void { fn generateOperation(allocator: *std.mem.Allocator, operation: smithy.ShapeInfo, shapes: anytype, writer: anytype) !void {
const camel_name = try camelCase(allocator, operation.name); const snake_case_name = try snake.fromPascalCase(allocator, operation.name);
defer allocator.free(camel_name); defer allocator.free(snake_case_name);
var type_stack = std.ArrayList(*const smithy.ShapeInfo).init(allocator); var type_stack = std.ArrayList(*const smithy.ShapeInfo).init(allocator);
defer type_stack.deinit(); defer type_stack.deinit();
// indent should start at 4 spaces here // indent should start at 4 spaces here
try writer.print(" {s}: struct ", .{camel_name}); try writer.print(" {s}: struct ", .{snake_case_name});
_ = try writer.write("{\n"); _ = try writer.write("{\n");
try writer.print(" action_name: []const u8 = \"{s}\",\n", .{operation.name}); try writer.print(" action_name: []const u8 = \"{s}\",\n", .{operation.name});
_ = try writer.write(" Request: type = "); _ = try writer.write(" Request: type = ");