google-protobuf 3.15.8 → 3.16.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of google-protobuf might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96c2ca558e26c88c63603ce4d0ab93eab2d07a17b93b7088b7f6b9855e50d984
4
- data.tar.gz: 36c03ec2e8b3ffd5acdfa70f9d6ddd26b378fc982e6b5173380c83bc80f8dccb
3
+ metadata.gz: 92bce6793f49890e0a5bf68cc233de1e6fea67d72f3ca7f335bee1bcb81061a3
4
+ data.tar.gz: '008e84cf532d86eb4ee6bb4a913be6d75fdffd18190759acf57ef0133e33989b'
5
5
  SHA512:
6
- metadata.gz: fc376ff9e7a2155ad2f0119b847a7fd651e5e50fc64ec0f794df39c3033d24a4cef4c0581ee888603a44d3e8a4e8e7f0fefb44057fef72f514e3a5ab41315fdb
7
- data.tar.gz: 42bf106275a675d871833b9c097a627b0ea434bc344209563ca800eb52590ccbdc7b59ebd0028658a5cfe4508555f87e59dcee01fd493b6e6c28ebbcb9ba6a91
6
+ metadata.gz: 7869abdbcc35d74152ed52fae04a763bd866a8b04cd2eb212f07ba37cf83bb92ac2fdaa4a06d4aa9dcf55c6ac6d13e0ecb0be3fc724947f5233a84e12180263d
7
+ data.tar.gz: 1d735c91494688d289c57852f7d7b4e015394851bad5fa7ddaf4ba3f5f6dd0395fd8b549c0bf5106ad370a7d324b876b66f3fe94fad8f0d4d2945d3f68d3aaed
@@ -868,6 +868,20 @@ static VALUE FieldDescriptor_default(VALUE _self) {
868
868
  return Convert_UpbToRuby(default_val, TypeInfo_get(self->fielddef), Qnil);
869
869
  }
870
870
 
871
+
872
+ /*
873
+ * call-seq:
874
+ * FieldDescriptor.json_name => json_name
875
+ *
876
+ * Returns this field's json_name, as a Ruby string, or nil if not yet set.
877
+ */
878
+ static VALUE FieldDescriptor_json_name(VALUE _self) {
879
+ FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
880
+ const upb_fielddef *f = self->fielddef;
881
+ const char *json_name = upb_fielddef_jsonname(f);
882
+ return rb_str_new2(json_name);
883
+ }
884
+
871
885
  /*
872
886
  * call-seq:
873
887
  * FieldDescriptor.label => label
@@ -1043,6 +1057,7 @@ static void FieldDescriptor_register(VALUE module) {
1043
1057
  rb_define_method(klass, "name", FieldDescriptor_name, 0);
1044
1058
  rb_define_method(klass, "type", FieldDescriptor__type, 0);
1045
1059
  rb_define_method(klass, "default", FieldDescriptor_default, 0);
1060
+ rb_define_method(klass, "json_name", FieldDescriptor_json_name, 0);
1046
1061
  rb_define_method(klass, "label", FieldDescriptor_label, 0);
1047
1062
  rb_define_method(klass, "number", FieldDescriptor_number, 0);
1048
1063
  rb_define_method(klass, "submsg_name", FieldDescriptor_submsg_name, 0);
@@ -1750,6 +1765,16 @@ static void msgdef_add_field(VALUE msgbuilder_rb, upb_label_t label, VALUE name,
1750
1765
  field_proto,
1751
1766
  FileBuilderContext_strdup(self->file_builder, default_value));
1752
1767
  }
1768
+
1769
+ if (rb_funcall(options, rb_intern("key?"), 1,
1770
+ ID2SYM(rb_intern("json_name"))) == Qtrue) {
1771
+ VALUE json_name =
1772
+ rb_hash_lookup(options, ID2SYM(rb_intern("json_name")));
1773
+
1774
+ google_protobuf_FieldDescriptorProto_set_json_name(
1775
+ field_proto,
1776
+ FileBuilderContext_strdup(self->file_builder, json_name));
1777
+ }
1753
1778
  }
1754
1779
 
1755
1780
  if (oneof_index >= 0) {
@@ -1899,18 +1924,20 @@ static VALUE MessageBuilderContext_required(int argc, VALUE* argv,
1899
1924
  */
1900
1925
  static VALUE MessageBuilderContext_repeated(int argc, VALUE* argv,
1901
1926
  VALUE _self) {
1902
- VALUE name, type, number, type_class;
1927
+ VALUE name, type, number;
1928
+ VALUE type_class, options = Qnil;
1903
1929
 
1904
- if (argc < 3) {
1905
- rb_raise(rb_eArgError, "Expected at least 3 arguments.");
1930
+ rb_scan_args(argc, argv, "32", &name, &type, &number, &type_class, &options);
1931
+
1932
+ // Allow passing (name, type, number, options) or
1933
+ // (name, type, number, type_class, options)
1934
+ if (argc == 4 && RB_TYPE_P(type_class, T_HASH)) {
1935
+ options = type_class;
1936
+ type_class = Qnil;
1906
1937
  }
1907
- name = argv[0];
1908
- type = argv[1];
1909
- number = argv[2];
1910
- type_class = (argc > 3) ? argv[3] : Qnil;
1911
1938
 
1912
1939
  msgdef_add_field(_self, UPB_LABEL_REPEATED, name, type, number, type_class,
1913
- Qnil, -1, false);
1940
+ options, -1, false);
1914
1941
 
1915
1942
  return Qnil;
1916
1943
  }
@@ -37,7 +37,7 @@
37
37
  #include "message.h"
38
38
  #include "repeated_field.h"
39
39
 
40
- VALUE cError;
40
+ VALUE cParseError;
41
41
  VALUE cTypeError;
42
42
 
43
43
  const upb_fielddef* map_field_key(const upb_fielddef* field) {
@@ -442,8 +442,10 @@ void Init_protobuf_c() {
442
442
  Map_register(protobuf);
443
443
  Message_register(protobuf);
444
444
 
445
- cError = rb_const_get(protobuf, rb_intern("Error"));
445
+ cParseError = rb_const_get(protobuf, rb_intern("ParseError"));
446
+ rb_gc_register_mark_object(cParseError);
446
447
  cTypeError = rb_const_get(protobuf, rb_intern("TypeError"));
448
+ rb_gc_register_mark_object(cTypeError);
447
449
 
448
450
  rb_define_singleton_method(protobuf, "discard_unknown",
449
451
  Google_Protobuf_discard_unknown, 1);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.8
4
+ version: 3.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-08 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
@@ -123,7 +123,7 @@ homepage: https://developers.google.com/protocol-buffers
123
123
  licenses:
124
124
  - BSD-3-Clause
125
125
  metadata:
126
- source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.15.8/ruby
126
+ source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.16.0/ruby
127
127
  post_install_message:
128
128
  rdoc_options: []
129
129
  require_paths:
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.2.15
142
+ rubygems_version: 3.2.17
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Protocol Buffers