Comments (6)
@tony612 can you try a quick patch, which is calling Code.ensure_loaded(type)
before calling type.key(1)
in the changes made in my PR?
from protobuf.
@whatyouhide I tried, but only using ensure_loaded
doesn't work. I think it's because we have a file like this
defmodule Foo.Msg do
use Protobuf, syntax: :proto3
field :type, 0, type: Foo.Enum, enum: true
end
defmodule Foo.Enum do
use Protobuf, enum: true, syntax: :proto3
field :UNKNOWN, 0
end
And Elixir can't compile a file like this, we have to write a file like
defmodule Foo.Enum do
use Protobuf, enum: true, syntax: :proto3
field :UNKNOWN, 0
end
defmodule Foo.Msg do
use Protobuf, syntax: :proto3
field :type, 0, type: Foo.Enum, enum: true
end
I tried adjuting the ordering of the generated code in this branch https://github.com/tony612/protobuf-elixir/compare/fix-gen-order?expand=1
This branch just put enum in the first in generated files, I'm not sure if this can cover every case, but our protos can be compiled successfully with it.
from protobuf.
@tony612 looks good to me :)
from protobuf.
I am having issues with this on 0.7.1
.
I am having an issue with enums defined in the same file are being generated at the bottom of the file. My work around is to move them to the top of the file but that has to be done every time we regenerate them.
from protobuf.
@mackeyja92 Could you regenerate the code after upgrading protoc plugin?
mix escript.install hex protobuf 0.7.1
The escript version is different from the protobuf
version in mix.exs.
from protobuf.
@tony612 Yes. That solved it for me. Thank you!
from protobuf.
Related Issues (20)
- How to use type specs? HOT 2
- Invalid field number 0 when decoding binary data HOT 3
- JSON decoding should work with "." in FieldMask path
- Can't create Firestore.V1.Value HOT 3
- Decoding Invalid Strings sometimes raise MatchError instead of Protobuf.DecodeError
- How to encode oneof fields? HOT 1
- The plugin one gets with "$ mix escript.install hex protobuf" seems to be old or broken HOT 2
- Let's release 1.0.0 HOT 2
- Encoding oneof attribute results in invalid struct HOT 2
- There's something wrong to get `.[...]` type
- Add option to use type_check during struct generation HOT 2
- (UndefinedFunctionError) function Protobuf.Encoder.encode/2 is undefined or private when running benchmarks HOT 1
- Error while trying to compile: google/cloud/secretmanager/v1/resources.proto HOT 1
- Any support unusable
- Consideration in generating options in Messages in OTP 26 HOT 3
- Inconsistent behaviour when encoding oneof HOT 3
- Can JSON decoder be loose on constraints about float? HOT 1
- `Protobuf.encode/1` does not actually verify struct in some cases HOT 2
- lib/elixirpb/pb_extension.pb.ex is missing in the package
- Warning on Elixir 1.16 + OTP 25 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protobuf.