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

kubernetes: ideas how to handle embedded fields. #24

Open
dilyevsky opened this issue Dec 6, 2018 · 2 comments
Open

kubernetes: ideas how to handle embedded fields. #24

dilyevsky opened this issue Dec 6, 2018 · 2 comments

Comments

@dilyevsky
Copy link
Contributor

dilyevsky commented Dec 6, 2018

Here's specific case: https://github.com/kubernetes/api/blob/d04500c8c3dda9c980b668c57abc2ca61efcf5c4/core/v1/types.go#L1957-L1958

This will be accepted fine when media type is protobuf but will render incorrectly to JSON/YAML (for diffs or if you want to do PATCH because protobufs for patches are not accepted). Since generated.proto loses all information that the field is meant to be inline, we need some other way of having that information available during json marshaling.

Example:

...
        livenessProbe:
          handler:
            httpGet:
              path: /healthz
              port: 80
          initialDelaySeconds: 10
...

Should be:

...
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 80
          initialDelaySeconds: 10
...
@dilyevsky
Copy link
Contributor Author

Just to be more clear - the stems from JSON inline tag not go type embedding.

@dilyevsky
Copy link
Contributor Author

Actually I found that standard lib encoding/json works as desired by noting the field is "anonymous" (embedded). Looks like this should be an issue to gogo/protobuf/jsonpb instead.

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

1 participant