Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Skylark] struct.to_proto support for dicts #7896

Closed
fangism opened this issue Mar 29, 2019 · 1 comment
Closed

[Skylark] struct.to_proto support for dicts #7896

fangism opened this issue Mar 29, 2019 · 1 comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request

Comments

@fangism
Copy link
Contributor

fangism commented Mar 29, 2019

Description of the problem / feature request:

Dicts are not supported in converting structs to_proto().
https://docs.bazel.build/versions/master/skylark/lib/struct.html#to_proto

Feature requests: what underlying problem are you trying to solve with this feature?

Improve convertibility from Skylark structs to proto.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

struct(foo={'a': 'b'}).to_proto()

What operating system are you running Bazel on?

Linux.

What's the output of bazel info release?

release blaze-2019.03.22-2 (mainline @239715033)

If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.

N/A

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

Related:
#5542 (similar request for JSON)

Any other information, logs, or outputs that you want to share?

Have a CL has a starting point for discussion, refers to two b/ s.

@brandjon brandjon added type: feature request P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Starlark labels Mar 29, 2019
alandonovan pushed a commit to google/starlark-go that referenced this issue Mar 29, 2019
This is a sketch of a standard module for JSON encoding/decoding for Starlark.

It is intended to subsume, generalize, and eventually
replace the ill-conceived struct.to_json method.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542

Change-Id: I297ffaee9349eedeeb52f5a88f40636a4095f997
alandonovan pushed a commit to google/starlark-go that referenced this issue Mar 29, 2019
This is a sketch of a standard module for JSON encoding/decoding for Starlark.

It is intended to subsume, generalize, and eventually
replace the ill-conceived struct.to_json method.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542

Change-Id: I297ffaee9349eedeeb52f5a88f40636a4095f997
alandonovan pushed a commit to google/starlark-go that referenced this issue Apr 2, 2019
This is a sketch of a standard module for JSON encoding/decoding for Starlark.

It is intended to subsume, generalize, and eventually
replace the ill-conceived struct.to_json method.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542

Change-Id: I297ffaee9349eedeeb52f5a88f40636a4095f997
@laurentlb
Copy link
Contributor

This looks reasonable to me. Even if there are problems with to_proto, allowing dicts here seems intuitive.

alandonovan pushed a commit to google/starlark-go that referenced this issue Mar 5, 2020
This change defines a standard Starlark module for JSON encoding and decoding.
See json.go for documentation.

It is intended to subsume, generalize, and eventually
replace Bazel's ill-conceived struct.to_json method.

The json module is predeclared in the Starlark REPL environment.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542
bazelbuild/bazel#10176

Change-Id: I297ffaee9349eedeeb52f5a88f40636a4095f997
alandonovan pushed a commit to google/starlark-go that referenced this issue Mar 5, 2020
This change defines a standard Starlark module for JSON encoding and decoding.
See json.go for documentation.

It is intended to subsume, generalize, and eventually
replace Bazel's ill-conceived struct.to_json method.

The json module is predeclared in the Starlark REPL environment.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542
bazelbuild/bazel#10176

Change-Id: I297ffaee9349eedeeb52f5a88f40636a4095f997
alandonovan pushed a commit to google/starlark-go that referenced this issue Mar 6, 2020
This change defines a standard Starlark module for JSON encoding and decoding.
See json.go for documentation.

It is intended to subsume, generalize, and eventually
replace Bazel's ill-conceived struct.to_json method.

The json module is predeclared in the Starlark REPL environment.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542
bazelbuild/bazel#10176

Change-Id: I297ffaee9349eedeeb52f5a88f40636a4095f997
alandonovan pushed a commit to google/starlark-go that referenced this issue Jun 11, 2020
This change defines a standard Starlark module for JSON encoding and decoding.
See json.go for documentation.

It is intended to subsume, generalize, and eventually
replace Bazel's ill-conceived struct.to_json method.

The json module is predeclared in the Starlark REPL environment.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542
bazelbuild/bazel#10176
bazelbuild/starlark#83
bazelbuild/bazel#3732

Change-Id: I297ffaee9349eedeeb52f5a88f40636a4095f997
alandonovan pushed a commit to google/starlark-go that referenced this issue Jun 11, 2020
This change defines a standard Starlark module for JSON encoding and decoding.
See json.go for documentation.

It is intended to subsume, generalize, and eventually
replace Bazel's ill-conceived struct.to_json method.

The json module is predeclared in the Starlark REPL environment.

See related issues:
bazelbuild/bazel#7896
https://buganizer.corp.google.com/issues/23962735
https://buganizer.corp.google.com/issues/70210417
bazelbuild/bazel#7879 (comment)
bazelbuild/bazel#5542
bazelbuild/bazel#10176
bazelbuild/starlark#83
bazelbuild/bazel#3732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants