Skip to content

Conversation

@alexander-fenster
Copy link
Contributor

@alexander-fenster alexander-fenster commented Sep 22, 2022

Fixing the type declaration to allow one very special case: a field extension that is a proto3 optional field. Internally, proto3 optional fields are represented as a single field oneofs, which makes it the first case ever when a oneof can be a nested object.

Example: bigquery-storage

extend google.protobuf.FieldOptions {
  optional string column_name = 454943157;
}

Related part of the JSON:

                      "nested": {
                        "_columnName": {
                          "oneof": [       <--- this is not accepted without the fix
                            "columnName"
                          ]
                        },
                        "columnName": {
                          "type": "string",
                          "id": 454943157,
                          "extend": "google.protobuf.FieldOptions",
                          "options": {
                            "proto3_optional": true
                          }
                        },

Yeah, also, last but not least, VSCode does not hang anymore, so removing that comment. It was added 6 years ago, not true anymore.

@alexander-fenster alexander-fenster merged commit 119d90a into master Sep 22, 2022
@alexander-fenster alexander-fenster deleted the dts-namespace-oneof branch September 22, 2022 18:28
@github-actions github-actions bot mentioned this pull request Sep 22, 2022
binsee pushed a commit to juzibot/protobuf.js that referenced this pull request Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants