question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support nested annotation syntax

See original GitHub issue

Describe the bug I am using https://github.com/envoyproxy/protoc-gen-validate to generate validators for my protobuf using annotations.

Both of the following are valid syntax and compiles properly, but is considered to be invalid by the protobuf plugin:

Formatted by https://github.com/uber/prototool

message SomeMessage {
  repeated string ids = 1 [
    (validate.rules).repeated = {
      items: {
        string: {
          len: 36
        }
      }
      min_items: 1
    }
  ];
}

In a single line:

message SomeMessage {
  repeated string ids = 1 [(validate.rules).repeated = {items {string {len: 36}}, min_items: 1}];
}

To Reproduce Steps to reproduce the behavior:

  1. Paste the above snippets into the editor and see errors being highlighted.

Expected behavior The above snippets are valid and should not be considered errors

Screenshots err

Plugin (please complete the following information):

  • OS: Windows 10 May Update
  • Plugin version: v0.13.0
  • IDE: GoLand 2019.1.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:20
  • Comments:9

github_iconTop GitHub Comments

8reactions
jvolkmancommented, Mar 26, 2020

Shameless plug for anyone that needs to use the types of long-form options described in this issue: https://plugins.jetbrains.com/plugin/14004

2reactions
jvolkmancommented, Sep 20, 2019

You mean that text format is fully supported to express option values in the language? When I said support was partial, I meant the support of text format in the protostuff compiler that is used by this plugin.

Yeah. This part of the proto language isn’t well-specified, but protoc just defers to the text format parser for these long form options (relevant code in descriptor.cc).

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Understanding structure / syntax of nested annotations
There are four annotations at play in your sample code: @NamedQueries + @NamedQuery and @NamedNativeQueries + @NamedNativeQuery .
Read more >
add support for nested java annotations · Issue #294 · scala/bug
In this example, the nested annotation is in an array value, but they should also be supported as single values:
Read more >
JUnit 5 Nested Class: @Nested Tutorial With Examples
@Nested annotation is used on a class and not on a specific test. An outermost class can never be annotated with @Nested. It...
Read more >
JUnit 5 User Guide
Denotes that the annotated class is a non-static nested test class. On Java 8 through Java 15, @BeforeAll and @AfterAll methods cannot be...
Read more >
Repeating Annotations - The Java Tutorials
It is now possible to use an annotation zero times, once, or, if the annotation's type is marked as @Repeatable , more than...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found