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

Expand google.protobuf.Any when emit p4info in text format #3731

Merged
merged 1 commit into from
Nov 25, 2022

Conversation

psivanup
Copy link
Contributor

The target specific extern instance and table properties are using the google.protobuf.Any message (p4info.proto). The google.protobuf.Any messages in runtime is required to be emitted in text format (human readable), not as serialized content. But the p4info text serializer outputs cryptic text (e.g. octal numbers) for google.protobuf.Any message.

This PR addresses this issue by using text format printer to serialize the messages to text. This printer instance allows us to set flag to expand the google.protobuf.Any message.

p4info.txt output before this change:

info {
    type_url: "type.googleapis.com/..."
    value: "\022\030\010\001\022\020object \010(\002\032\017\010\001\022\ttype\030\001...."
}

p4info.txt output after this change

info {
    [type.googleapis.com/...]
    fields {
        id: 1
        name: "object"
    }
    ...
}

Copy link
Contributor

@usha1830 usha1830 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@usha1830 usha1830 merged commit d57fd8b into p4lang:main Nov 25, 2022
@psivanup psivanup deleted the p4info-txt-expanded branch November 25, 2022 04:08
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 this pull request may close these issues.

2 participants