Open rbtcollins opened 11 months ago
Building e.g. https://github.com/hashicorp/terraform/blob/main/docs/plugin-protocol/tfplugin5.4.proto seems to skip emitting the Serialize implementation for some structs vs what happens with a type_attr of "#[derive(serde::Deserialize, serde::Serialize)]
"#[derive(serde::Deserialize, serde::Serialize)]
With prost-serde-derive:
$ cargo expand --bin terraform2rust |& grep impl.*Serialize impl _serde::Serialize for Diagnostic { impl _serde::Serialize for AttributePath { impl _serde::Serialize for Selector { impl _serde::Serialize for Schema { impl _serde::Serialize for Block { impl _serde::Serialize for Attribute { impl _serde::Serialize for NestedBlock { impl _serde::Serialize for ServerCapabilities {
With serde-derive:
$ cargo expand --bin terraform2rust |& grep impl.*Serialize impl _serde::Serialize for Diagnostic { impl _serde::Serialize for AttributePath { impl _serde::Serialize for Step { impl _serde::Serialize for Selector { impl _serde::Serialize for Schema { impl _serde::Serialize for Block { impl _serde::Serialize for Attribute { impl _serde::Serialize for NestedBlock { impl _serde::Serialize for Response { impl _serde::Serialize for ServerCapabilities {
In particular notice Response is missing
tonic_build setup:
tonic_build::configure() .type_attribute("GetProviderSchema.Response", attr_value) .type_attribute("GetProviderSchema.ServerCapabilities", attr_value) .type_attribute("Diagnostic", attr_value) .type_attribute("Schema", attr_value) .type_attribute("Schema.Block", attr_value) .type_attribute("Schema.Attribute", attr_value) .type_attribute("Schema.NestedBlock", attr_value) .type_attribute("AttributePath", attr_value) .type_attribute("AttributePath.Step", attr_value) .type_attribute("AttributePath.Step.selector", attr_value) .compile(&[filename], &[&protos])
with prost-serde-derive: let attr_value = "#[derive(prost_serde_derive::Deserialize, prost_serde_derive::Serialize)]"; with serde-derive: let attr_value = "#[derive(serde::Deserialize, serde::Serialize)]";
let attr_value = "#[derive(prost_serde_derive::Deserialize, prost_serde_derive::Serialize)]";
let attr_value = "#[derive(serde::Deserialize, serde::Serialize)]";
Sorry for late response. I'll have a look asap.
Building e.g. https://github.com/hashicorp/terraform/blob/main/docs/plugin-protocol/tfplugin5.4.proto seems to skip emitting the Serialize implementation for some structs vs what happens with a type_attr of
"#[derive(serde::Deserialize, serde::Serialize)]
With prost-serde-derive:
With serde-derive:
In particular notice Response is missing
tonic_build setup:
with prost-serde-derive:
let attr_value = "#[derive(prost_serde_derive::Deserialize, prost_serde_derive::Serialize)]";
with serde-derive:let attr_value = "#[derive(serde::Deserialize, serde::Serialize)]";