Git Product home page Git Product logo

Comments (7)

bufdev avatar bufdev commented on June 12, 2024

There is actually an alternate syntax without the ':' after 'foo' that is also valid in Protobuf:

syntax = "proto3";

package baz;

option (foo.bar) = {
  woot: 100
  foo {
    hello: 200
  }
};

See https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2beta2/dlp.proto#L96

Here's a diff on service_test.go that breaks:

$ git diff
diff --git a/service_test.go b/service_test.go
index 058c885..0a4fc5d 100644
--- a/service_test.go
+++ b/service_test.go
@@ -86,6 +86,10 @@ func TestRPCWithOptionAggregateSyntax(t *testing.T) {
                        option (test_ident) = {
                                test: "test"
                                test2:"test2"
+                               addtional_bindings {
+                                       hello: "value"
+                                       hello2: "value2"
+                               }
                        }; // inline test_ident
                }
        }`

This results in found "{" but expected [option aggregate key colon :]

from proto.

emicklei avatar emicklei commented on June 12, 2024

ATM aggregations are stored in AggregatedConstants. With this recursive example, this is no longer valid. Need to think about this a bit more

from proto.

emicklei avatar emicklei commented on June 12, 2024

in the PR, Issue #60 , the constants are flattened.
in your example given, there will be a constant called foo.hello

from proto.

bufdev avatar bufdev commented on June 12, 2024

This won't work for other arbitrary cases. For example, what if I have a repeated field in the message? so foo.hello is a repeated string? What if it has a oneof, etc?

This might be fine to start, but just of note :-)

from proto.

bufdev avatar bufdev commented on June 12, 2024

This is still broken, will write a test.

from proto.

bufdev avatar bufdev commented on June 12, 2024

See the PR I just wrote, two things need to be handled:

  1. Having a : after the key before a complex option
  2. Having the value be on a separate line

from proto.

emicklei avatar emicklei commented on June 12, 2024

closing this as #60 is merged

from proto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.