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

No documentation for many auto generated types. #1233

Open
bmenasha opened this issue Jun 7, 2018 · 6 comments
Open

No documentation for many auto generated types. #1233

bmenasha opened this issue Jun 7, 2018 · 6 comments
Labels
api: cloudasset Issues related to the Cloud Asset Inventory API. api: monitoring Issues related to the Cloud Monitoring API. api: redis Issues related to the Memorystore for Redis API. codegen type: docs Improvement to the documentation for an API.

Comments

@bmenasha
Copy link

bmenasha commented Jun 7, 2018

There is no documentation for the fields of the

google.cloud.monitoring_v3.types.MetricDescriptor
google.cloud.monitoring_v3.types.MessageOptions
(and many others)

in the generated docmentation here:

https://google-cloud-python.readthedocs.io/en/latest/monitoring/gapic/v3/types.html

Or consider

google.cloud.redis_v1beta1.types.Operation

in

https://google-cloud-python.readthedocs.io/en/latest/redis/gapic/v1beta1/types.html

These classes have fields that are generated from protobuf messages yet there is no documentation.

My attempts to use auto completion in common IDEs like pycharm, visual studio code, emacs's elpy all fail. Is there an IDE that does auto completion successfully on these types I can use?

Thanks

@tseaver tseaver added type: question Request for information or clarification. Not an issue. api: monitoring Issues related to the Cloud Monitoring API. labels Jun 7, 2018
@tseaver
Copy link
Contributor

tseaver commented Jun 7, 2018

@bmenasha Thanks for the report. PR googleapis/google-cloud-python#5364 made a change such that shared types (such as google.longrunning.operation_pb2.Operation no longer have their modules overwritten. I argued (in issue googleapis/google-cloud-python#4715) that overwriting them even for "local" types was wrong: your report that it breaks IDE code completion is a telling point there.

WRT the docstrings: I can see that, for instance, google.api.metric.MetricDescriptor has a least a one-line comment which should be carried over into the generated code, ISTM.

@bmenasha
Copy link
Author

bmenasha commented Jun 7, 2018

Well, I can't get auto completion working with any of pycharm, elpy, or vscode for the auto generated classes in google.api.metric_pb2 either.

While docstring would be nice. I'm primary complaining about the lack of any fields on these types in any python documentation I can find. The only way to determine what fields exists is to read protobuf definitions or examine the type at runtime with help(). This is all fine by me because I expect everything to be hard, but some developers might expect our client library documentation to document the interface.

thanks for the quick reply.

@tseaver
Copy link
Contributor

tseaver commented Jun 7, 2018

@bmenasha I can see the "empty" types you reference here.

@theacodes Is this an issue we should be solving in the codegen side?

@tseaver tseaver added the api: redis Issues related to the Memorystore for Redis API. label Sep 17, 2018
@tseaver
Copy link
Contributor

tseaver commented Oct 18, 2018

/cc @lukesneeringer Can you suggest a way we could get docs generating properly for the "common" API proto messages?

@JustinBeckwith JustinBeckwith added the type: docs Improvement to the documentation for an API. label Oct 18, 2018
@tseaver tseaver removed the type: question Request for information or clarification. Not an issue. label Dec 4, 2018
@bmenasha
Copy link
Author

bmenasha commented Dec 12, 2018

Even for those types which aren't "common" our documentation is poor.

Consider the new cloud asset API. We expose: export_assets() which accepts a output_config. We document this here https://googleapis.github.io/google-cloud-python/latest/asset/gapic/v1beta1/types.html#google.cloud.asset_v1beta1.types.OutputConfig with:

class google.cloud.asset_v1beta1.types.OutputConfig
    Output configuration for export assets destination.
        destination
            Asset export destination.
        gcs_destination
            Destination on Cloud Storage. 

What's the type of gcs_destionation? a string? why both "destination" and gcs_destionatoin" who knows! I'm back to reading autogenerated python protobuf source for this.

Here is the protobuf definition for this type:

// Output configuration for export assets destination.
message OutputConfig {
  // Asset export destination.
  oneof destination {
    // Destination on Cloud Storage.
    GcsDestination gcs_destination = 1;
  }
}

What is this "oneof", Doesn't seem to make sense to use oneof for a single field. right? It produces confusing documentation and users.

thanks

@meredithslota
Copy link

I think maybe this issue should be moved to the python microgenerator repo, but I don't have permission to do that. @AlanGasperini thoughts?

@parthea parthea transferred this issue from googleapis/google-cloud-python Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudasset Issues related to the Cloud Asset Inventory API. api: monitoring Issues related to the Cloud Monitoring API. api: redis Issues related to the Memorystore for Redis API. codegen type: docs Improvement to the documentation for an API.
Projects
None yet
Development

No branches or pull requests

4 participants