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

Several pbjson options are missing #49

Closed
torkelrogstad opened this issue Jan 31, 2023 · 0 comments · Fixed by #50
Closed

Several pbjson options are missing #49

torkelrogstad opened this issue Jan 31, 2023 · 0 comments · Fixed by #50

Comments

@torkelrogstad
Copy link
Contributor

The protoc-gen-prost-serde documentation states the following: This tool supports all the same options from pbjson-build.

This is not correct. One example is ignore_unknown_fields, there could be more as well. The options in pbjson-build can be found here.

The code that sets these options can be found here:

impl str::FromStr for Parameters {
type Err = InvalidParameter;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut ret_val = Self::default();
for param in Params::from_protoc_plugin_opts(s)? {
match param {
Param::Parameter {
param: "default_package_filename",
}
| Param::Value {
param: "default_package_filename",
..
} => ret_val.default_package_filename = param.value().map(|s| s.into_owned()),
Param::Parameter {
param: "retain_enum_prefix",
}
| Param::Value {
param: "retain_enum_prefix",
value: "true",
} => ret_val.retain_enum_prefix = true,
Param::Value {
param: "retain_enum_prefix",
value: "false",
} => (),
Param::Parameter {
param: "preserve_proto_field_names",
}
| Param::Value {
param: "preserve_proto_field_names",
value: "true",
} => ret_val.preserve_proto_field_names = true,
Param::Value {
param: "preserve_proto_field_names",
value: "false",
} => (),
Param::Parameter {
param: "no_include",
}
| Param::Value {
param: "no_include",
value: "true",
} => ret_val.no_include = true,
Param::Value {
param: "no_include",
value: "false",
} => (),
Param::KeyValue {
param: "extern_path",
key: prefix,
value: module,
} => ret_val.extern_path.push((prefix.to_string(), module)),
_ => return Err(InvalidParameter::from(param)),
}
}
Ok(ret_val)
}
}

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 a pull request may close this issue.

1 participant