Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

SampleGen: generate one source code file per sample definition #2682

Closed
beccasaurus opened this issue Apr 3, 2019 · 4 comments
Closed

SampleGen: generate one source code file per sample definition #2682

beccasaurus opened this issue Apr 3, 2019 · 4 comments
Assignees
Labels
Core: Sample-gen priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.

Comments

@beccasaurus
Copy link
Contributor

~ Placeholder issue ~


Expected output of the sample generator is: a list of code source files, one for each region tag. The name of the file should == the region tag, when possible (language dependent).

This will require a default calling form which generates samples which match DPE's canonicals, 1 source code file per sample definition.

In Node.js, Python, Ruby, PHP, Go ~ the file name should be exactly region_tag.ext
Probably the same in C#, but PascalCase.
Java must be the class name, iirc.

#PLACEHOLDER


@googleapis/samplegen

@beccasaurus beccasaurus added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. Core: Sample-gen labels Apr 3, 2019
@yihanzhen
Copy link
Contributor

We could make region tag the class name for Java?

@beccasaurus
Copy link
Contributor Author

For now let's do region tag across the board. In Java/C# this'll mean the class name should == Region Tag (although not actually a language requirement for C#)

region_tag speech_transcribe_v1beta1
C# SpeechTranscribeV1beta1.cs
Go speech_transcribe_v1beta1.go
Java SpeechTranscribeV1beta1.java
Node.js speechTranscribeV1beta1.js
PHP speech_transcribe_v1beta1.go
Python speech_transcribe_v1beta1.py
Ruby speech_transcribe_v1beta1.rb

@vchudnov-g
Copy link
Contributor

Let's implement this by making the filename be the region tag if we generate exactly one sample with that region tag. If, in a given language, we generate n>1 samples for the same region tag, let's disambiguate by appending the calling form to at least (n-1) samples in that language.

One idea is to disambiguate all of them with the suffix. Another idea is that if the default calling form is produced only once, that sample does not get a disambiguating suffix but the other samples do. (I like that latter idea, once we have implemented default calling forms!)

@yihanzhen yihanzhen self-assigned this Apr 22, 2019
@yihanzhen
Copy link
Contributor

Fixed by #2713

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core: Sample-gen priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.
Projects
None yet
Development

No branches or pull requests

3 participants