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

Problem with google.protobuf.StringValue #238

Open
zion03 opened this issue Apr 28, 2023 · 3 comments
Open

Problem with google.protobuf.StringValue #238

zion03 opened this issue Apr 28, 2023 · 3 comments

Comments

@zion03
Copy link

zion03 commented Apr 28, 2023

Hi!
I have the following proto-buff schema:

message User {	 
string firstName = 1;
google.protobuf.StringValue email = 2;
}

And payload looks like this:

{
firstName: "User name",
email: '[email protected]'
}

And I'm receiving following error:

{
    "error": {
        "message": "invalid payload",
        "paths": [
            [
                "email.object expected"
            ]
        ],
        "correctBodyExample": " { \"firstName\": \"User name\",   \"email\": \"[email protected]\"}"
    }
}

But when I convert email into the object it works correctly:

{
firstName: "User name",
email: { value: '[email protected]' }
}

Could you advise how to fix this problem?
Thanks!

@alphaspl0it
Copy link

Hi. There's a couple of things you could try.

It isn't clear if you have imported the proto reference at the start of your proto file?

And have you tried using double quotes for the email field of the payload?

Let me know if either of those work.

@alphaspl0it
Copy link

@zion03 did this work? 🤞

@aleksanderaleksic
Copy link

Same problem for me with the following schema:

syntax = "proto3";

import "google/protobuf/wrappers.proto";

message PowerData {
  google.protobuf.StringValue powerSource = 1;
  google.protobuf.StringValue batteryStatus = 2;
  google.protobuf.StringValue lastUpdated = 3;
  google.protobuf.DoubleValue powerSourceVoltage = 4;
  google.protobuf.DoubleValue batteryVoltage = 5;
  google.protobuf.Int32Value batteryPercent = 6;
  google.protobuf.BoolValue batteryLow = 7;
  google.protobuf.BoolValue batteryChargeOk = 8;
  google.protobuf.BoolValue psuOk = 9;
}

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

No branches or pull requests

3 participants