Skip to content

Commit

Permalink
fix: struct field names should not be lowercase (#364)
Browse files Browse the repository at this point in the history
Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com>
  • Loading branch information
alvarowolfx and sofisl authored Aug 18, 2023
1 parent 07794c1 commit 1867062
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/adapt/proto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function convertTableFieldSchemaToFieldDescriptorProto(
scope: string,
useProto3: boolean
): FieldDescriptorProto {
const name = `${field.name}`.toLowerCase();
const name = field.name;
const type = field.type;
if (!type) {
throw Error(`table field ${name} missing type`);
Expand All @@ -241,7 +241,7 @@ function convertTableFieldSchemaToFieldDescriptorProto(
throw Error(`table field type ${type} not supported`);
}
fdp = new FieldDescriptorProto({
name: field.name,
name: name,
number: fNumber,
type: pType,
label: label,
Expand Down
10 changes: 5 additions & 5 deletions test/adapt/proto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('Adapt Protos', () => {
mode: 'NULLABLE',
},
{
name: 'details',
name: 'recordDetails',
type: 'STRUCT',
mode: 'REPEATED',
fields: [
Expand Down Expand Up @@ -136,11 +136,11 @@ describe('Adapt Protos', () => {
options: {},
},
{
name: 'details',
name: 'recordDetails',
number: 2,
label: 'LABEL_REPEATED',
type: 'TYPE_MESSAGE',
typeName: 'Nested_details',
typeName: 'Nested_recordDetails',
},
{
name: 'metadata',
Expand All @@ -152,7 +152,7 @@ describe('Adapt Protos', () => {
],
nestedType: [
{
name: 'Nested_details',
name: 'Nested_recordDetails',
field: [
{
name: 'key',
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('Adapt Protos', () => {
const NestedProto = (Type as any).fromDescriptor(protoDescriptor);
const raw = {
record_id: '12345',
details: [
recordDetails: [
{key: 'name', value: 'jimmy'},
{key: 'title', value: 'clown'},
],
Expand Down

0 comments on commit 1867062

Please sign in to comment.