pulumi / pulumi-google-native

Apache License 2.0
71 stars 18 forks source link

Canonical casing for modules and resources #111

Open mikhailshilkov opened 3 years ago

mikhailshilkov commented 3 years ago

It's not entirely clear how we should build type names for modules and resources. Discovery document names and resource names are often in lowercase and different fields like title, canonicalName differ in consistency from service to service.

As a result, we have to maintain a few manual maps (example) to get what we think is right but it would be nice to have an authoritative source for that.

Protobuf has an annotation for this: image

Can discovery get this too?

tequilarista commented 3 years ago

Discovery docs should largely be camelCase, but translation into language specific APIs may conform to language convention (i.e. Go is usually lower case and C# is Pascal case for package names).

mikhailshilkov commented 3 years ago

A couple of examples:

tequilarista commented 3 years ago

Similar to other discussions, this could be another good opportunity to fall back to the proto defs for additional info, especially where it relates to language convention, e.g. you can see the language variants for managedidentities here: https://github.com/googleapis/googleapis/blob/d76f26f335b2b570b7e19d938f35f9894236e565/google/cloud/managedidentities/v1/managedidentities_gapic.yaml#L9-L10

toumorokoshi commented 1 year ago

Ideally, all resources in proto should be annotated with google.api.resource, like this example for OrgPolicy.

The resource name is unique and should be cased properly.

That should be reliable convention in the future. For multiple patterns prefixing with the parent container object makes sense (e.g. Project + Policy to create ProjectPolicy.