-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Generate enum strings for Compute #860
Conversation
(Note that we could remove one piece of config by generating one type per FileDescriptor, and using the name of the FileDescriptor as a prefix with a hard-coded suffix. Compute only has Testing: this is basically tested by running it against the Compute API and checking that the result is "identical" (in semantic diff terms) to the current code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nits, but LGTM.
I'm totally happy with this as is, we can figure things out if we ever need to.
|
||
public static CompilationUnitSyntax MaybeGenerate(SourceFileContext ctx, string ns, IEnumerable<FileDescriptor> packageFileDescriptors) | ||
{ | ||
// TODO: Add an option in the service config for this... although |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: seems incomplete... although I'll probably be happy with what comes after the although :)
namespace Google.Api.Generator.Generation; | ||
|
||
/// <summary> | ||
/// Generates (to stdout) a static class (with nested static classes) to provide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Generates (to stdout) a static class (with nested static classes) to provide | |
/// Generates a static class (with nested static classes) to provide |
/// <summary> | ||
/// Generates (to stdout) a static class (with nested static classes) to provide | ||
/// string constants for the wire representations of enum values. This is only used | ||
/// for DIREGAPIC APIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// for DIREGAPIC APIs. | |
/// for DIREGAPIC APIs which is just the Compute API. |
if (Descriptor is not null) | ||
{ | ||
Utils.Logging.LogWarning("Typ of {name} is {fullname}", Descriptor.FullName, ProtoTyp.Of(Descriptor).FullName); | ||
//throw new Exception($"Typ of {Descriptor.FullName} is {ProtoTyp.Of(Descriptor).FullName}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: leftover
This moves code from google-cloud-dotnet to the generator, removing the post-processing. We can probably adopt this as-is for the moment (given that this is only for DIREGAPIC, and only Compute uses DIREGAPIC) but we should really have configuration within the service config publish settings to turn this feature on (and potentially configure the filename; that'll be easier to tell if we end up with more examples).
This moves code from google-cloud-dotnet to the generator, removing the post-processing.
We can probably adopt this as-is for the moment (given that this is only for DIREGAPIC, and only Compute uses DIREGAPIC) but we should really have configuration within the service config publish settings to turn this feature on (and potentially configure the filename; that'll be easier to tell if we end up with more examples).