├── .circleci ├── artman_config.yaml ├── config.yml ├── discogapic_compute_build.gradle └── gapic-generator-it-test.json.enc ├── .github ├── CODEOWNERS ├── release-please.yml ├── snippet-bot.yml └── sync-repo-settings.yaml ├── .gitignore ├── BUILD.bazel ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── DEVELOPMENT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── WORKSPACE ├── benchmark ├── .gitignore ├── README.md ├── clients │ ├── go │ │ └── local.go │ ├── java │ │ └── pubsub │ │ │ ├── pom.xml │ │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── google │ │ │ └── cloud │ │ │ └── bench │ │ │ └── Pubsub.java │ └── php │ │ ├── composer.json │ │ └── local.php └── server │ └── server.go ├── build.gradle ├── buildSrc └── src │ └── main │ └── groovy │ ├── DependencyResolver.groovy │ └── Symlinks.groovy ├── dependencies.properties ├── gapic_generator.bzl ├── generate_clients.py ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── license-header-javadoc.txt ├── renovate.json ├── repositories.bzl ├── repository_rules.bzl ├── rules_gapic ├── BUILD.bazel ├── README.md ├── bazel │ ├── BUILD.bazel │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── google │ │ │ └── api │ │ │ └── codegen │ │ │ └── bazel │ │ │ ├── ApiDir.java │ │ │ ├── ApiVersionedDir.java │ │ │ ├── ApisVisitor.java │ │ │ ├── ArgsParser.java │ │ │ ├── BUILD.bazel.gapic_api.mustache │ │ │ ├── BUILD.bazel.raw_api.mustache │ │ │ ├── BUILD.bazel.root_api.mustache │ │ │ ├── BazelBuildFileTemplate.java │ │ │ ├── BazelBuildFileView.java │ │ │ ├── BuildFileGenerator.java │ │ │ └── Buildozer.java │ │ └── test │ │ ├── data │ │ ├── buildozer │ │ │ └── BUILD.bazel.template │ │ └── googleapis │ │ │ └── google │ │ │ └── example │ │ │ └── library │ │ │ ├── BUILD.bazel.baseline │ │ │ ├── library_example_v1.yaml │ │ │ └── v1 │ │ │ ├── BUILD.bazel.baseline │ │ │ ├── library.proto │ │ │ ├── library_example_gapic.yaml │ │ │ └── library_example_grpc_service_config.json │ │ └── java │ │ └── com │ │ └── google │ │ └── api │ │ └── codegen │ │ └── bazel │ │ └── BuildFileGeneratorTest.java ├── csharp │ ├── BUILD.bazel │ ├── csharp_gapic.bzl │ └── csharp_gapic_pkg.bzl ├── gapic.bzl ├── gapic_pkg.bzl ├── go │ ├── BUILD.bazel │ ├── go_gapic.bzl │ ├── go_gapic_pkg.bzl │ └── go_gapic_repositories.bzl ├── java │ ├── BUILD.bazel │ ├── java_gapic.bzl │ ├── java_gapic_pkg.bzl │ ├── java_gapic_repositories.bzl │ └── resources │ │ └── gradle │ │ ├── assembly.gradle.tmpl │ │ ├── client.gradle.tmpl │ │ ├── client_disco.gradle.tmpl │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ ├── grpc.gradle.tmpl │ │ ├── proto.gradle.tmpl │ │ └── settings.gradle.tmpl ├── nodejs │ ├── BUILD.bazel │ ├── nodejs_gapic.bzl │ └── nodejs_gapic_pkg.bzl ├── php │ ├── BUILD.bazel │ ├── php_gapic.bzl │ ├── php_gapic_pkg.bzl │ ├── php_gapic_repositories.bzl │ └── resources │ │ ├── README.md │ │ └── php-7.1.30_linux_x86_64.tar.gz ├── python │ ├── BUILD.bazel │ ├── py_gapic.bzl │ ├── py_gapic_pkg.bzl │ └── py_gapic_repositories.bzl └── ruby │ ├── BUILD.bazel │ ├── ruby_gapic.bzl │ └── ruby_gapic_pkg.bzl ├── settings.gradle ├── showcase ├── go │ └── showcase_integration_test.go ├── java │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── test │ │ └── java │ │ └── com │ │ └── google │ │ └── api │ │ └── showcase │ │ ├── ShowcaseHeaderProvider.java │ │ ├── ShowcaseTest.java │ │ └── ShowcaseTransportChannelProvider.java ├── nodejs │ ├── .gitignore │ ├── index.js │ ├── karma.conf.js │ ├── package.json │ └── webpack.config.js ├── php │ ├── composer.json │ ├── phpunit.xml.dist │ └── tests │ │ └── ShowcaseIntegrationTest.php ├── python │ ├── .gitignore │ ├── nox.py │ └── tests │ │ └── showcase_integration_test.py └── ruby │ ├── Gemfile │ ├── Gemfile.lock │ └── showcase_integration_test.rb ├── src ├── main │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── api │ │ │ └── codegen │ │ │ ├── ArtifactType.java │ │ │ ├── GeneratorMain.java │ │ │ ├── ProtocGeneratorMain.java │ │ │ ├── SnippetSetRunner.java │ │ │ ├── clientconfig │ │ │ ├── ClientConfigGapicContext.java │ │ │ ├── ClientConfigSnippetSet.java │ │ │ ├── ClientConfigSnippetSetRunner.java │ │ │ └── php │ │ │ │ └── PhpClientConfigGapicContext.java │ │ │ ├── common │ │ │ ├── CodeGenerator.java │ │ │ ├── CodegenContext.java │ │ │ ├── GeneratedResult.java │ │ │ └── TargetLanguage.java │ │ │ ├── config │ │ │ ├── AnyResourceNameConfig.java │ │ │ ├── ApiDefaultsConfig.java │ │ │ ├── ApiModel.java │ │ │ ├── BatchingConfig.java │ │ │ ├── Configs.java │ │ │ ├── DependenciesConfig.java │ │ │ ├── DiscoApiModel.java │ │ │ ├── DiscoGapicInterfaceConfig.java │ │ │ ├── DiscoGapicInterfaceContext.java │ │ │ ├── DiscoGapicMethodConfig.java │ │ │ ├── DiscoGapicMethodContext.java │ │ │ ├── DiscoInterfaceModel.java │ │ │ ├── DiscoveryField.java │ │ │ ├── DiscoveryMethodModel.java │ │ │ ├── DiscoveryRequestType.java │ │ │ ├── FieldConfig.java │ │ │ ├── FieldConfigFactory.java │ │ │ ├── FieldModel.java │ │ │ ├── FixedResourceNameConfig.java │ │ │ ├── FlatteningConfig.java │ │ │ ├── FlatteningConfigs.java │ │ │ ├── FlowControlLimitConfig.java │ │ │ ├── GapicInterfaceConfig.java │ │ │ ├── GapicInterfaceContext.java │ │ │ ├── GapicInterfaceInput.java │ │ │ ├── GapicMethodConfig.java │ │ │ ├── GapicMethodContext.java │ │ │ ├── GapicProductConfig.java │ │ │ ├── GenericFieldSelector.java │ │ │ ├── GrpcGapicRetryMapping.java │ │ │ ├── GrpcStreamingConfig.java │ │ │ ├── InterfaceConfig.java │ │ │ ├── InterfaceContext.java │ │ │ ├── InterfaceModel.java │ │ │ ├── LongRunningConfig.java │ │ │ ├── MethodConfig.java │ │ │ ├── MethodContext.java │ │ │ ├── MethodModel.java │ │ │ ├── OneofConfig.java │ │ │ ├── OutputContext.java │ │ │ ├── PackageMetadataConfig.java │ │ │ ├── PackagingConfig.java │ │ │ ├── PageStreamingConfig.java │ │ │ ├── ProductConfig.java │ │ │ ├── ProductServiceConfig.java │ │ │ ├── ProtoApiModel.java │ │ │ ├── ProtoField.java │ │ │ ├── ProtoFieldSelector.java │ │ │ ├── ProtoInterfaceModel.java │ │ │ ├── ProtoMethodModel.java │ │ │ ├── ProtoTypeRef.java │ │ │ ├── ResourceDescriptorConfig.java │ │ │ ├── ResourceNameConfig.java │ │ │ ├── ResourceNameMessageConfig.java │ │ │ ├── ResourceNameMessageConfigs.java │ │ │ ├── ResourceNameOneofConfig.java │ │ │ ├── ResourceNamePatternConfig.java │ │ │ ├── ResourceNameType.java │ │ │ ├── RetryCodesConfig.java │ │ │ ├── SampleConfig.java │ │ │ ├── SampleContext.java │ │ │ ├── SampleParameterConfig.java │ │ │ ├── SampleSpec.java │ │ │ ├── SingleResourceNameConfig.java │ │ │ ├── SmokeTestConfig.java │ │ │ ├── TransportProtocol.java │ │ │ ├── TypeModel.java │ │ │ ├── VersionBound.java │ │ │ └── VisibilityConfig.java │ │ │ ├── configgen │ │ │ ├── CollectionPattern.java │ │ │ ├── ConfigGenerator.java │ │ │ ├── ConfigHelper.java │ │ │ ├── ConfigYamlNodeReader.java │ │ │ ├── DiscoConfigGeneratorApp.java │ │ │ ├── GapicConfigGeneratorApp.java │ │ │ ├── HttpPagingParameters.java │ │ │ ├── InterfaceTransformer.java │ │ │ ├── ListTransformer.java │ │ │ ├── MessageGenerator.java │ │ │ ├── MethodTransformer.java │ │ │ ├── MissingFieldTransformer.java │ │ │ ├── NodeFinder.java │ │ │ ├── NodeVisitor.java │ │ │ ├── PageStreamingTransformer.java │ │ │ ├── PagingParameters.java │ │ │ ├── ProtoInterfaceTransformer.java │ │ │ ├── ProtoMethodTransformer.java │ │ │ ├── ProtoPageStreamingTransformer.java │ │ │ ├── ProtoPagingParameters.java │ │ │ ├── README.md │ │ │ ├── mergers │ │ │ │ ├── CollectionMerger.java │ │ │ │ ├── ConfigMerger.java │ │ │ │ ├── InterfaceMerger.java │ │ │ │ ├── LanguageSettingsMerger.java │ │ │ │ ├── MethodMerger.java │ │ │ │ ├── PageStreamingMerger.java │ │ │ │ ├── ProtoConfigMerger.java │ │ │ │ └── RetryMerger.java │ │ │ ├── nodes │ │ │ │ ├── BaseConfigNode.java │ │ │ │ ├── ConfigNode.java │ │ │ │ ├── FieldConfigNode.java │ │ │ │ ├── ListItemConfigNode.java │ │ │ │ ├── NullConfigNode.java │ │ │ │ ├── ScalarConfigNode.java │ │ │ │ └── metadata │ │ │ │ │ ├── Comment.java │ │ │ │ │ ├── DefaultComment.java │ │ │ │ │ ├── FixmeComment.java │ │ │ │ │ └── NullComment.java │ │ │ ├── transformer │ │ │ │ ├── CollectionTransformer.java │ │ │ │ ├── DiscoConfigTransformer.java │ │ │ │ ├── DiscoveryMethodTransformer.java │ │ │ │ ├── InputSpecificMethodTransformer.java │ │ │ │ ├── LanguageTransformer.java │ │ │ │ ├── MethodTransformer.java │ │ │ │ └── RetryTransformer.java │ │ │ └── viewmodel │ │ │ │ ├── CollectionView.java │ │ │ │ ├── ConfigView.java │ │ │ │ ├── FieldNamePatternView.java │ │ │ │ ├── FlatteningGroupView.java │ │ │ │ ├── FlatteningView.java │ │ │ │ ├── InterfaceView.java │ │ │ │ ├── LanguageSettingView.java │ │ │ │ ├── MethodView.java │ │ │ │ ├── PageStreamingRequestView.java │ │ │ │ ├── PageStreamingResponseView.java │ │ │ │ ├── PageStreamingView.java │ │ │ │ ├── ResourceNameGenerationView.java │ │ │ │ ├── RetryCodeView.java │ │ │ │ └── RetryParamView.java │ │ │ ├── discogapic │ │ │ ├── DiscoGapicGenerator.java │ │ │ ├── DiscoGapicGeneratorApp.java │ │ │ ├── DiscoGapicGeneratorFactory.java │ │ │ ├── DocumentGenerator.java │ │ │ ├── EmptyTypeModel.java │ │ │ ├── SchemaTransformationContext.java │ │ │ └── transformer │ │ │ │ ├── DiscoGapicNamer.java │ │ │ │ ├── DiscoGapicParser.java │ │ │ │ └── java │ │ │ │ ├── JavaDiscoGapicRequestToViewTransformer.java │ │ │ │ ├── JavaDiscoGapicResourceNameToViewTransformer.java │ │ │ │ ├── JavaDiscoGapicSchemaToViewTransformer.java │ │ │ │ └── JavaDiscoGapicSurfaceTransformer.java │ │ │ ├── discovery │ │ │ ├── DiscoveryNode.java │ │ │ ├── Document.java │ │ │ ├── Method.java │ │ │ ├── Node.java │ │ │ ├── Schema.java │ │ │ └── StandardSchemaGenerator.java │ │ │ ├── gapic │ │ │ ├── ArtifactFlags.java │ │ │ ├── CommonGapicCodePathMapper.java │ │ │ ├── CommonSampleCodePathMapper.java │ │ │ ├── FileGapicWriter.java │ │ │ ├── GapicCodePathMapper.java │ │ │ ├── GapicContext.java │ │ │ ├── GapicGenerator.java │ │ │ ├── GapicGeneratorApp.java │ │ │ ├── GapicGeneratorFactory.java │ │ │ ├── GapicParser.java │ │ │ ├── GapicWriter.java │ │ │ ├── LegacyGapicGenerator.java │ │ │ ├── PackageNameCodePathMapper.java │ │ │ ├── ProtoFiles.java │ │ │ ├── ProtoModels.java │ │ │ ├── ProtocGapicWriter.java │ │ │ ├── ServiceMessages.java │ │ │ └── StaticResourcesGenerator.java │ │ │ ├── java │ │ │ ├── JavaGapicCodePathMapper.java │ │ │ └── JavaGapicSamplePathMapper.java │ │ │ ├── metacode │ │ │ ├── FieldStructureParser.java │ │ │ ├── InitCodeContext.java │ │ │ ├── InitCodeLineType.java │ │ │ ├── InitCodeNode.java │ │ │ ├── InitFieldConfig.java │ │ │ ├── InitValue.java │ │ │ └── InitValueConfig.java │ │ │ ├── nodejs │ │ │ ├── NodeJSCodePathMapper.java │ │ │ └── NodeJSUtils.java │ │ │ ├── packagegen │ │ │ ├── PackageGenerator.java │ │ │ ├── PackageGeneratorApp.java │ │ │ ├── PackageGeneratorFactory.java │ │ │ ├── PackagingArtifactType.java │ │ │ ├── java │ │ │ │ ├── JavaGrpcPackageGenerator.java │ │ │ │ └── JavaPackageTransformer.java │ │ │ └── py │ │ │ │ ├── PythonGrpcPackageGenerator.java │ │ │ │ ├── PythonGrpcPackageTransformer.java │ │ │ │ ├── PythonPackageCopier.java │ │ │ │ └── PythonPackageCopierResult.java │ │ │ ├── php │ │ │ └── PhpGapicCodePathMapper.java │ │ │ ├── rendering │ │ │ └── CommonSnippetSetRunner.java │ │ │ ├── ruby │ │ │ └── RubyUtil.java │ │ │ ├── transformer │ │ │ ├── ApiCallableTransformer.java │ │ │ ├── ApiMethodParamTransformer.java │ │ │ ├── BatchingTransformer.java │ │ │ ├── DefaultFeatureConfig.java │ │ │ ├── DynamicLangApiMethodTransformer.java │ │ │ ├── DynamicLangGapicSamplesTransformer.java │ │ │ ├── FeatureConfig.java │ │ │ ├── FileHeaderTransformer.java │ │ │ ├── GrpcElementDocTransformer.java │ │ │ ├── GrpcStubTransformer.java │ │ │ ├── HeaderRequestParamTransformer.java │ │ │ ├── ImportSectionTransformer.java │ │ │ ├── ImportTypeTable.java │ │ │ ├── InitCodeTransformer.java │ │ │ ├── LongRunningTransformer.java │ │ │ ├── MockServiceTransformer.java │ │ │ ├── ModelToViewTransformer.java │ │ │ ├── ModelTypeFormatter.java │ │ │ ├── ModelTypeFormatterImpl.java │ │ │ ├── ModelTypeNameConverter.java │ │ │ ├── ModelTypeTable.java │ │ │ ├── OutputTransformer.java │ │ │ ├── PackageMetadataNamer.java │ │ │ ├── PackageMetadataTransformer.java │ │ │ ├── PageStreamingTransformer.java │ │ │ ├── ParamWithSimpleDoc.java │ │ │ ├── PathTemplateTransformer.java │ │ │ ├── RetryDefinitionsTransformer.java │ │ │ ├── SampleFileRegistry.java │ │ │ ├── SampleImportTransformer.java │ │ │ ├── SampleManifestTransformer.java │ │ │ ├── SampleMetadataNamer.java │ │ │ ├── SampleTransformer.java │ │ │ ├── SchemaTypeFormatter.java │ │ │ ├── SchemaTypeFormatterImpl.java │ │ │ ├── SchemaTypeNameConverter.java │ │ │ ├── SchemaTypeTable.java │ │ │ ├── ServiceTransformer.java │ │ │ ├── StandardImportSectionTransformer.java │ │ │ ├── StandardSampleImportTransformer.java │ │ │ ├── StaticLangApiMethodTransformer.java │ │ │ ├── StaticLangGapicSamplesTransformer.java │ │ │ ├── StaticLangResourceObjectTransformer.java │ │ │ ├── SurfaceNamer.java │ │ │ ├── SurfaceTransformer.java │ │ │ ├── Synchronicity.java │ │ │ ├── TestCaseTransformer.java │ │ │ ├── TransformationContext.java │ │ │ ├── TypeFormatter.java │ │ │ ├── TypeNameConverter.java │ │ │ ├── csharp │ │ │ │ ├── CSharpApiMethodTransformer.java │ │ │ │ ├── CSharpBasicPackageTransformer.java │ │ │ │ ├── CSharpCommonTransformer.java │ │ │ │ ├── CSharpEnumNamer.java │ │ │ │ ├── CSharpFeatureConfig.java │ │ │ │ ├── CSharpGapicClientPackageTransformer.java │ │ │ │ ├── CSharpGapicClientTransformer.java │ │ │ │ ├── CSharpGapicSmokeTestTransformer.java │ │ │ │ ├── CSharpGapicSnippetsTransformer.java │ │ │ │ ├── CSharpGapicUnitTestTransformer.java │ │ │ │ ├── CSharpModelTypeNameConverter.java │ │ │ │ ├── CSharpSampleImportTransformer.java │ │ │ │ ├── CSharpSampleMetadataNamer.java │ │ │ │ ├── CSharpStandaloneSampleTransformer.java │ │ │ │ └── CSharpSurfaceNamer.java │ │ │ ├── go │ │ │ │ ├── GoGapicSurfaceTestTransformer.java │ │ │ │ ├── GoGapicSurfaceTransformer.java │ │ │ │ ├── GoImportSectionTransformer.java │ │ │ │ ├── GoModelTypeNameConverter.java │ │ │ │ └── GoSurfaceNamer.java │ │ │ ├── java │ │ │ │ ├── JavaApiMethodTransformer.java │ │ │ │ ├── JavaFeatureConfig.java │ │ │ │ ├── JavaGapicPackageTransformer.java │ │ │ │ ├── JavaGapicSamplesPackageTransformer.java │ │ │ │ ├── JavaGapicSamplesTransformer.java │ │ │ │ ├── JavaGapicSurfaceTransformer.java │ │ │ │ ├── JavaModelTypeNameConverter.java │ │ │ │ ├── JavaPackageMetadataNamer.java │ │ │ │ ├── JavaSampleImportTransformer.java │ │ │ │ ├── JavaSampleMetadataNamer.java │ │ │ │ ├── JavaSchemaTypeNameConverter.java │ │ │ │ ├── JavaSurfaceNamer.java │ │ │ │ ├── JavaSurfaceTestTransformer.java │ │ │ │ └── JavaSurfaceTransformer.java │ │ │ ├── nodejs │ │ │ │ ├── NodeJSApiMethodParamTransformer.java │ │ │ │ ├── NodeJSFeatureConfig.java │ │ │ │ ├── NodeJSGapicSamplesTransformer.java │ │ │ │ ├── NodeJSGapicSurfaceDocTransformer.java │ │ │ │ ├── NodeJSGapicSurfaceTestTransformer.java │ │ │ │ ├── NodeJSGapicSurfaceTransformer.java │ │ │ │ ├── NodeJSImportSectionTransformer.java │ │ │ │ ├── NodeJSModelTypeNameConverter.java │ │ │ │ ├── NodeJSPackageMetadataNamer.java │ │ │ │ ├── NodeJSPackageMetadataTransformer.java │ │ │ │ ├── NodeJSSampleImportTransformer.java │ │ │ │ ├── NodeJSSampleMetadataNamer.java │ │ │ │ ├── NodeJSSamplePackageMetadataTransformer.java │ │ │ │ └── NodeJSSurfaceNamer.java │ │ │ ├── php │ │ │ │ ├── PhpApiMethodParamTransformer.java │ │ │ │ ├── PhpFeatureConfig.java │ │ │ │ ├── PhpGapicSamplesTransformer.java │ │ │ │ ├── PhpGapicSurfaceTestTransformer.java │ │ │ │ ├── PhpGapicSurfaceTransformer.java │ │ │ │ ├── PhpImportSectionTransformer.java │ │ │ │ ├── PhpModelTypeNameConverter.java │ │ │ │ ├── PhpPackageMetadataNamer.java │ │ │ │ ├── PhpPackageMetadataTransformer.java │ │ │ │ ├── PhpSampleImportTransformer.java │ │ │ │ ├── PhpSampleMetadataNamer.java │ │ │ │ └── PhpSurfaceNamer.java │ │ │ ├── py │ │ │ │ ├── PythonApiMethodParamTransformer.java │ │ │ │ ├── PythonGapicSamplesTransformer.java │ │ │ │ ├── PythonGapicSurfaceTestTransformer.java │ │ │ │ ├── PythonGapicSurfaceTransformer.java │ │ │ │ ├── PythonImportSectionTransformer.java │ │ │ │ ├── PythonModelTypeNameConverter.java │ │ │ │ ├── PythonPackageMetadataTransformer.java │ │ │ │ ├── PythonSampleImportTransformer.java │ │ │ │ ├── PythonSampleMetadataNamer.java │ │ │ │ └── PythonSurfaceNamer.java │ │ │ └── ruby │ │ │ │ ├── RubyApiMethodParamTransformer.java │ │ │ │ ├── RubyFeatureConfig.java │ │ │ │ ├── RubyGapicSamplesTransformer.java │ │ │ │ ├── RubyGapicSurfaceDocTransformer.java │ │ │ │ ├── RubyGapicSurfaceTestTransformer.java │ │ │ │ ├── RubyGapicSurfaceTransformer.java │ │ │ │ ├── RubyImportSectionTransformer.java │ │ │ │ ├── RubyModelTypeNameConverter.java │ │ │ │ ├── RubyPackageMetadataNamer.java │ │ │ │ ├── RubyPackageMetadataTransformer.java │ │ │ │ ├── RubySampleMetadataNamer.java │ │ │ │ ├── RubySamplePackageMetadataTransformer.java │ │ │ │ └── RubySurfaceNamer.java │ │ │ ├── util │ │ │ ├── CommentPatterns.java │ │ │ ├── CommentReformatter.java │ │ │ ├── CommentTransformer.java │ │ │ ├── CommonAcronyms.java │ │ │ ├── CommonRenderingUtil.java │ │ │ ├── ConfigVersionValidator.java │ │ │ ├── DynamicLangTypeTable.java │ │ │ ├── ErrorMarkdownVisitor.java │ │ │ ├── EscaperFactory.java │ │ │ ├── ImportType.java │ │ │ ├── Inflector.java │ │ │ ├── LanguageUtil.java │ │ │ ├── LicenseHeaderUtil.java │ │ │ ├── LinkPattern.java │ │ │ ├── MultiYamlReader.java │ │ │ ├── Name.java │ │ │ ├── NameFormatter.java │ │ │ ├── NameFormatterDelegator.java │ │ │ ├── NamePath.java │ │ │ ├── ProtoParser.java │ │ │ ├── SampleConfigSanitizer.java │ │ │ ├── Scanner.java │ │ │ ├── StaticResourcesHandler.java │ │ │ ├── StringUtil.java │ │ │ ├── SymbolTable.java │ │ │ ├── TypeAlias.java │ │ │ ├── TypeName.java │ │ │ ├── TypeNameConverter.java │ │ │ ├── TypeTable.java │ │ │ ├── TypedValue.java │ │ │ ├── VersionMatcher.java │ │ │ ├── csharp │ │ │ │ ├── CSharpAliasMode.java │ │ │ │ ├── CSharpCommentReformatter.java │ │ │ │ ├── CSharpImports.java │ │ │ │ ├── CSharpNameFormatter.java │ │ │ │ ├── CSharpRenderingUtil.java │ │ │ │ ├── CSharpTypeTable.java │ │ │ │ └── README.md │ │ │ ├── go │ │ │ │ ├── GoCommentReformatter.java │ │ │ │ ├── GoNameFormatter.java │ │ │ │ └── GoTypeTable.java │ │ │ ├── java │ │ │ │ ├── JavaCommentReformatter.java │ │ │ │ ├── JavaNameFormatter.java │ │ │ │ ├── JavaRenderingUtil.java │ │ │ │ └── JavaTypeTable.java │ │ │ ├── js │ │ │ │ ├── JSCommentReformatter.java │ │ │ │ ├── JSNameFormatter.java │ │ │ │ └── JSTypeTable.java │ │ │ ├── php │ │ │ │ ├── PhpCommentReformatter.java │ │ │ │ ├── PhpNameFormatter.java │ │ │ │ ├── PhpPackageUtil.java │ │ │ │ └── PhpTypeTable.java │ │ │ ├── py │ │ │ │ ├── PythonCommentReformatter.java │ │ │ │ ├── PythonDocstringUtil.java │ │ │ │ ├── PythonNameFormatter.java │ │ │ │ ├── PythonRenderingUtil.java │ │ │ │ └── PythonTypeTable.java │ │ │ ├── ruby │ │ │ │ ├── RubyCommentReformatter.java │ │ │ │ ├── RubyNameFormatter.java │ │ │ │ └── RubyTypeTable.java │ │ │ └── testing │ │ │ │ ├── PythonValueProducer.java │ │ │ │ ├── StandardValueProducer.java │ │ │ │ ├── TestValueGenerator.java │ │ │ │ └── ValueProducer.java │ │ │ └── viewmodel │ │ │ ├── AccessorView.java │ │ │ ├── ApiCallSettingsView.java │ │ │ ├── ApiCallableImplType.java │ │ │ ├── ApiCallableView.java │ │ │ ├── ApiMethodDocView.java │ │ │ ├── ApiMethodView.java │ │ │ ├── BatchingConfigView.java │ │ │ ├── BatchingDescriptorClassView.java │ │ │ ├── BatchingDescriptorView.java │ │ │ ├── BatchingPartitionKeyView.java │ │ │ ├── CallableMethodDetailView.java │ │ │ ├── CallingForm.java │ │ │ ├── ClientMethodType.java │ │ │ ├── CredentialsClassFileView.java │ │ │ ├── CredentialsClassView.java │ │ │ ├── DescriptorConfigView.java │ │ │ ├── DynamicLangDefaultableParamView.java │ │ │ ├── DynamicLangSampleView.java │ │ │ ├── DynamicLangXApiSubclassView.java │ │ │ ├── DynamicLangXApiView.java │ │ │ ├── FieldSettingView.java │ │ │ ├── FileHeaderView.java │ │ │ ├── FormatResourceFunctionView.java │ │ │ ├── FormattedInitValueView.java │ │ │ ├── GrpcDocView.java │ │ │ ├── GrpcElementDocView.java │ │ │ ├── GrpcEnumDocView.java │ │ │ ├── GrpcEnumValueDocView.java │ │ │ ├── GrpcMessageDocView.java │ │ │ ├── GrpcStreamingDetailView.java │ │ │ ├── GrpcStubView.java │ │ │ ├── HeaderRequestParamView.java │ │ │ ├── HttpMethodSelectorView.java │ │ │ ├── HttpMethodView.java │ │ │ ├── IamResourceView.java │ │ │ ├── ImportFileView.java │ │ │ ├── ImportSectionView.java │ │ │ ├── ImportTypeView.java │ │ │ ├── InitCodeLineView.java │ │ │ ├── InitCodeView.java │ │ │ ├── InitValueView.java │ │ │ ├── ListInitCodeLineView.java │ │ │ ├── ListMethodDetailView.java │ │ │ ├── LongRunningOperationDetailView.java │ │ │ ├── MapEntryView.java │ │ │ ├── MapInitCodeLineView.java │ │ │ ├── MapParamDocView.java │ │ │ ├── MethodDescriptorView.java │ │ │ ├── MethodSampleView.java │ │ │ ├── ModifyMethodView.java │ │ │ ├── OneofConfigView.java │ │ │ ├── OptionalArrayMethodView.java │ │ │ ├── OutputView.java │ │ │ ├── PackageInfoView.java │ │ │ ├── PageStreamingDescriptorClassView.java │ │ │ ├── PageStreamingDescriptorView.java │ │ │ ├── PagedListResponseFactoryClassView.java │ │ │ ├── PagedResponseIterateMethodView.java │ │ │ ├── ParamDocView.java │ │ │ ├── ParseResourceFunctionView.java │ │ │ ├── PathTemplateCheckView.java │ │ │ ├── PathTemplateGetterFunctionView.java │ │ │ ├── PathTemplateView.java │ │ │ ├── PrintArgView.java │ │ │ ├── ReadFileInitCodeLineView.java │ │ │ ├── RepeatedResourceNameInitValueView.java │ │ │ ├── RequestObjectMethodDetailView.java │ │ │ ├── RequestObjectParamView.java │ │ │ ├── ReroutedGrpcView.java │ │ │ ├── ResourceIdParamView.java │ │ │ ├── ResourceNameFixedView.java │ │ │ ├── ResourceNameInitValueView.java │ │ │ ├── ResourceNameOneofInitValueView.java │ │ │ ├── ResourceNameOneofView.java │ │ │ ├── ResourceNameParamView.java │ │ │ ├── ResourceNameSingleView.java │ │ │ ├── ResourceNameType.java │ │ │ ├── ResourceNameView.java │ │ │ ├── ResourceProtoFieldView.java │ │ │ ├── ResourceProtoView.java │ │ │ ├── RestConfigView.java │ │ │ ├── RestInterfaceConfigView.java │ │ │ ├── RestMethodConfigView.java │ │ │ ├── RestPlaceholderConfigView.java │ │ │ ├── RetryCodesDefinitionView.java │ │ │ ├── RetryConfigDefinitionView.java │ │ │ ├── RetryParamsDefinitionView.java │ │ │ ├── SampleEntryPointView.java │ │ │ ├── SampleFunctionDocView.java │ │ │ ├── SampleFunctionParameterView.java │ │ │ ├── SampleValueSetView.java │ │ │ ├── ServiceDocView.java │ │ │ ├── ServiceMethodType.java │ │ │ ├── SettingsDocView.java │ │ │ ├── SimpleInitCodeLineView.java │ │ │ ├── SimpleInitValueView.java │ │ │ ├── SimpleParamDocView.java │ │ │ ├── SnippetsFileView.java │ │ │ ├── StaticLangApiAndSettingsFileView.java │ │ │ ├── StaticLangApiMessageFileView.java │ │ │ ├── StaticLangApiMessageView.java │ │ │ ├── StaticLangApiMethodSnippetView.java │ │ │ ├── StaticLangApiMethodView.java │ │ │ ├── StaticLangApiResourceNameFileView.java │ │ │ ├── StaticLangApiResourceNameView.java │ │ │ ├── StaticLangApiView.java │ │ │ ├── StaticLangCallableFactoryView.java │ │ │ ├── StaticLangClientExampleFileView.java │ │ │ ├── StaticLangClientFileView.java │ │ │ ├── StaticLangFileView.java │ │ │ ├── StaticLangMemberView.java │ │ │ ├── StaticLangPagedResponseView.java │ │ │ ├── StaticLangResourceNamesView.java │ │ │ ├── StaticLangRpcStubView.java │ │ │ ├── StaticLangSampleClassView.java │ │ │ ├── StaticLangSettingsView.java │ │ │ ├── StaticLangStubInterfaceView.java │ │ │ ├── StaticLangStubSettingsView.java │ │ │ ├── StructureInitCodeLineView.java │ │ │ ├── UnpagedListCallableMethodDetailView.java │ │ │ ├── ViewModel.java │ │ │ ├── metadata │ │ │ ├── ModuleView.java │ │ │ ├── PackageDependencyView.java │ │ │ ├── PackageMetadataView.java │ │ │ ├── ReadmeMetadataView.java │ │ │ ├── SampleManifestView.java │ │ │ ├── SimpleInitFileView.java │ │ │ ├── SimpleModuleView.java │ │ │ ├── TocContentView.java │ │ │ ├── TocModuleView.java │ │ │ ├── VersionIndexRequireView.java │ │ │ ├── VersionIndexType.java │ │ │ └── VersionIndexView.java │ │ │ └── testing │ │ │ ├── ClientInitParamView.java │ │ │ ├── ClientTestAssertView.java │ │ │ ├── ClientTestClassView.java │ │ │ ├── ClientTestFileView.java │ │ │ ├── GrpcStreamingView.java │ │ │ ├── MockCombinedView.java │ │ │ ├── MockGrpcMethodView.java │ │ │ ├── MockRpcResponseView.java │ │ │ ├── MockServiceImplFileView.java │ │ │ ├── MockServiceImplView.java │ │ │ ├── MockServiceUsageView.java │ │ │ ├── MockServiceView.java │ │ │ ├── PageStreamingResponseView.java │ │ │ ├── SmokeTestClassView.java │ │ │ └── TestCaseView.java │ ├── proto │ │ └── com │ │ │ └── google │ │ │ └── api │ │ │ └── codegen │ │ │ ├── config.proto │ │ │ ├── grpc │ │ │ └── service_config.proto │ │ │ ├── samplegen │ │ │ └── v1p2 │ │ │ │ └── sample_config_v1p2.proto │ │ │ └── v2 │ │ │ └── config_v2.proto │ └── resources │ │ └── com │ │ └── google │ │ └── api │ │ └── codegen │ │ ├── LICENSE.snip │ │ ├── clientconfig │ │ ├── common.snip │ │ ├── json.snip │ │ └── python_clientconfig.snip │ │ ├── common.snip │ │ ├── configgen │ │ └── gapic_config.snip │ │ ├── copyright-google.txt │ │ ├── csharp │ │ ├── client.snip │ │ ├── commandline.snip │ │ ├── common.snip │ │ ├── common_initcode.snip │ │ ├── gapic_client.snip │ │ ├── gapic_csproj.snip │ │ ├── gapic_resourcenames.snip │ │ ├── gapic_samples_csproj.snip │ │ ├── gapic_samples_program.snip │ │ ├── gapic_smoketest.snip │ │ ├── gapic_smoketest_csproj.snip │ │ ├── gapic_snippets.snip │ │ ├── gapic_snippets_csproj.snip │ │ ├── gapic_unittest.snip │ │ ├── gapic_unittest_csproj.snip │ │ ├── lro_sample.snip │ │ ├── paged_sample.snip │ │ ├── response.snip │ │ ├── standalone_sample.snip │ │ ├── streaming_sample.snip │ │ └── unary_sample.snip │ │ ├── go │ │ ├── doc.snip │ │ ├── example.snip │ │ ├── header.snip │ │ ├── initcode.snip │ │ ├── main.snip │ │ ├── mock.snip │ │ └── smoke.snip │ │ ├── java │ │ ├── build_gapic.gradle.snip │ │ ├── build_gapic_samples.gradle.snip │ │ ├── common.snip │ │ ├── grpc_callable_factory.snip │ │ ├── http_callable_factory.snip │ │ ├── http_stub.snip │ │ ├── http_test.snip │ │ ├── initcode.snip │ │ ├── main.snip │ │ ├── message.snip │ │ ├── method_sample.snip │ │ ├── mock_service.snip │ │ ├── mock_service_impl.snip │ │ ├── package-info.snip │ │ ├── resource_name.snip │ │ ├── resource_name_factory.snip │ │ ├── settings.snip │ │ ├── smoke_test.snip │ │ ├── standalone_sample.snip │ │ ├── static │ │ │ ├── build.gradle │ │ │ ├── gradle │ │ │ │ └── wrapper │ │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ │ └── gradle-wrapper.properties │ │ │ ├── gradlew │ │ │ ├── gradlew.bat │ │ │ └── settings.gradle │ │ ├── stub.snip │ │ ├── stub_interface.snip │ │ ├── stub_settings.snip │ │ └── test.snip │ │ ├── license-header-apache-2.0.txt │ │ ├── metadatagen │ │ ├── java │ │ │ └── grpc │ │ │ │ ├── build_base.gradle.snip │ │ │ │ ├── build_grpc.gradle.snip │ │ │ │ ├── build_protobuf.gradle.snip │ │ │ │ ├── pom_base.xml.snip │ │ │ │ ├── pom_grpc.xml.snip │ │ │ │ └── pom_protobuf.xml.snip │ │ ├── py │ │ │ ├── MANIFEST.in.snip │ │ │ ├── PUBLISHING.rst.snip │ │ │ ├── README.rst.snip │ │ │ └── setup.py.snip │ │ ├── sample_manifest.snip │ │ └── samplegen.snip │ │ ├── nodejs │ │ ├── README.md.snip │ │ ├── common.snip │ │ ├── index.snip │ │ ├── init_code.snip │ │ ├── main.snip │ │ ├── message.snip │ │ ├── method_sample.snip │ │ ├── package.json.snip │ │ ├── protos.snip │ │ ├── sample_package.json.snip │ │ ├── smoke_test.snip │ │ ├── standalone_sample.snip │ │ ├── test.snip │ │ ├── version_browser.snip │ │ ├── version_index.snip │ │ └── webpack.config.js.snip │ │ ├── packaging │ │ ├── api_defaults.yaml │ │ └── dependencies.yaml │ │ ├── php │ │ ├── client_impl.snip │ │ ├── common.snip │ │ ├── composer.snip │ │ ├── descriptor_config.snip │ │ ├── method_sample.snip │ │ ├── partial_veneer_client.snip │ │ ├── rest_config.snip │ │ ├── smoke_test.snip │ │ ├── standalone_sample.snip │ │ └── test.snip │ │ ├── py │ │ ├── MANIFEST.in.snip │ │ ├── README.rst.snip │ │ ├── __init__.py.snip │ │ ├── common.snip │ │ ├── docs │ │ │ ├── api.rst.snip │ │ │ ├── conf.py.snip │ │ │ ├── index.rst.snip │ │ │ └── types.rst.snip │ │ ├── enum.snip │ │ ├── main.snip │ │ ├── method_sample.snip │ │ ├── namespace__init__.py.snip │ │ ├── noxfile.py.snip │ │ ├── readme_common.snip │ │ ├── sample_init.snip │ │ ├── setup.py.snip │ │ ├── setup_cfg.snip │ │ ├── smoke_test.snip │ │ ├── standalone_sample.snip │ │ ├── test.snip │ │ ├── top_level_entry_point.snip │ │ ├── transport.snip │ │ ├── types.snip │ │ └── versioned_directory__init__.py.snip │ │ ├── readme.snip │ │ ├── readme_rst.snip │ │ └── ruby │ │ ├── CHANGELOG.md.snip │ │ ├── Gemfile.snip │ │ ├── Gemfile_sample.snip │ │ ├── README.md.snip │ │ ├── Rakefile.snip │ │ ├── common.snip │ │ ├── credentials.snip │ │ ├── gemspec.snip │ │ ├── gitignore.snip │ │ ├── initcode.snip │ │ ├── main.snip │ │ ├── message.snip │ │ ├── method_sample.snip │ │ ├── response.snip │ │ ├── rubocop.yml.snip │ │ ├── smoke_test.snip │ │ ├── standalone_sample.snip │ │ ├── test.snip │ │ ├── version_index.snip │ │ └── yardopts.snip └── test │ └── java │ └── com │ └── google │ └── api │ └── codegen │ ├── CodegenTestUtil.java │ ├── MixedPathTestDataLocator.java │ ├── config │ ├── FeatureConfigTest.java │ ├── FieldConfigFactoryTest.java │ ├── FlatteningConfigTest.java │ ├── GapicConfigProducerTest.java │ ├── LongRunningConfigTest.java │ ├── PackagingConfigTest.java │ ├── PageStreamingConfigTest.java │ ├── ProtoApiModelScopesTest.java │ ├── ResourceDescriptorConfigTest.java │ ├── ResourceNameMessageConfigsTest.java │ ├── ResourceNamePatternConfigTest.java │ ├── SampleSpecTest.java │ └── testdata │ │ ├── missing_config_schema_version.yaml │ │ └── missing_interface_v1.yaml │ ├── configgen │ ├── CollectionPatternTest.java │ ├── ConfigGenerationTest.java │ ├── ListTransformerTest.java │ ├── MissingFieldTransformerTest.java │ ├── nodes │ │ ├── BaseConfigNodeTest.java │ │ ├── FieldConfigNodeTest.java │ │ ├── ListItemConfigNodeTest.java │ │ └── NullConfigNodeTest.java │ └── testdata │ │ ├── library_config.baseline │ │ ├── longrunning_config.baseline │ │ ├── multiple_services_config.baseline │ │ └── no_path_templates_config.baseline │ ├── discogapic │ ├── DiscoConfigBaselineTestCase.java │ ├── DiscoConfigGenerationTest.java │ ├── DiscoGapicTestBase.java │ ├── JavaDiscoGapicGeneratorTest.java │ ├── testdata │ │ ├── java │ │ │ └── java_simplecompute.v1.json.baseline │ │ ├── simplecompute.v1.json │ │ ├── simplecompute_config.baseline │ │ ├── simplecompute_gapic.yaml │ │ └── simplecompute_pkg2.yaml │ └── transformer │ │ └── DiscoGapicParserTest.java │ ├── discovery │ ├── SchemaTest.java │ └── testdata │ │ ├── array.json │ │ ├── auth_3lo.json │ │ ├── auth_adc.json │ │ ├── auth_api_key.json │ │ ├── basicinfo.json │ │ ├── document.json │ │ ├── document_.json │ │ ├── graph.json │ │ ├── method.json │ │ ├── method_.json │ │ ├── schema.json │ │ ├── schema_.json │ │ └── type.json │ ├── gapic │ ├── GapicCodeGeneratorTest.java │ ├── GapicGeneratorAppTest.java │ ├── GapicTestBase2.java │ ├── GapicTestConfig.java │ ├── GapicTestModelGenerator.java │ ├── ProtocGapicPluginGeneratorTest.java │ └── testdata │ │ ├── csharp │ │ └── csharp_library.baseline │ │ ├── go │ │ └── go_library.baseline │ │ ├── java │ │ ├── java_library.baseline │ │ ├── java_multiple_services.baseline │ │ ├── java_my_streaming_proto.baseline │ │ └── java_no_path_templates.baseline │ │ ├── nodejs │ │ ├── nodejs_library.baseline │ │ ├── nodejs_multiple_services.baseline │ │ └── nodejs_no_path_templates.baseline │ │ ├── php │ │ ├── php_library.baseline │ │ ├── php_longrunning.baseline │ │ └── php_no_path_templates.baseline │ │ ├── py │ │ ├── python_library.baseline │ │ ├── python_multiple_services.baseline │ │ └── python_no_path_templates.baseline │ │ └── ruby │ │ ├── ruby_library.baseline │ │ ├── ruby_longrunning.baseline │ │ └── ruby_multiple_services.baseline │ ├── metacode │ ├── SampleInitCodeTest.java │ └── testdata │ │ ├── myproto.proto │ │ └── myproto.yaml │ ├── packagegen │ ├── PackageGeneratorAppTest.java │ └── testdata │ │ ├── api_defaults.yaml │ │ ├── common_protos_pkg2.yaml │ │ ├── fakeprotodir │ │ └── test │ │ │ └── nested │ │ │ └── v1 │ │ │ └── test_pb2.py │ │ ├── java_common_protos.baseline │ │ ├── java_grpc_stubs.baseline │ │ ├── java_library.baseline │ │ ├── library.proto │ │ ├── library.yaml │ │ ├── library_pkg2.yaml │ │ ├── library_stubs_pkg2.yaml │ │ └── python_library.baseline │ ├── php │ └── PhpGapicCodePathMapperTest.java │ ├── protoannotations │ ├── GapicCodeGeneratorAnnotationsTest.java │ └── testdata │ │ ├── csharp_library.baseline │ │ ├── go_library.baseline │ │ ├── java_library.baseline │ │ ├── java_library_no_gapic_config.baseline │ │ ├── java_library_no_gapic_config_http.baseline │ │ ├── java_library_with_grpc_service_config.baseline │ │ ├── nodejs_library.baseline │ │ ├── php_library.baseline │ │ ├── php_library_rest.baseline │ │ ├── php_library_with_grpc_service_config.baseline │ │ ├── python_library.baseline │ │ ├── python_library_no_gapic_config.baseline │ │ ├── ruby_library.baseline │ │ └── ruby_library_no_gapic_config.baseline │ ├── ruby │ └── RubyUtilTest.java │ ├── testsrc │ ├── common │ │ ├── another_service.proto │ │ ├── book_from_anywhere.proto │ │ ├── different_submodule.proto │ │ ├── errors.proto │ │ ├── field_mask.proto │ │ ├── frozen_dependencies.yaml │ │ ├── library.proto │ │ ├── library.yaml │ │ ├── library_pkg2.yaml │ │ ├── longrunning.proto │ │ ├── longrunning.yaml │ │ ├── longrunning_pkg2.yaml │ │ ├── multiple_services.proto │ │ ├── multiple_services.yaml │ │ ├── multiple_services_pkg2.yaml │ │ ├── multiple_services_v2.proto │ │ ├── my_streaming_proto.proto │ │ ├── my_streaming_proto.yaml │ │ ├── my_streaming_proto_pkg2.yaml │ │ ├── myproto.proto │ │ ├── myproto.yaml │ │ ├── no_path_templates.proto │ │ ├── no_path_templates.yaml │ │ ├── no_path_templates_messages.proto │ │ ├── no_path_templates_pkg2.yaml │ │ ├── other_shared_type.proto │ │ ├── shared_type.proto │ │ └── tagger.proto │ ├── gapicconfig │ │ ├── another_service.proto │ │ ├── book_from_anywhere.proto │ │ ├── different_submodule.proto │ │ ├── errors.proto │ │ ├── field_mask.proto │ │ ├── frozen_dependencies.yaml │ │ ├── library.proto │ │ ├── library.yaml │ │ ├── library_gapic.yaml │ │ ├── library_pkg2.yaml │ │ ├── longrunning.proto │ │ ├── longrunning.yaml │ │ ├── longrunning_gapic.yaml │ │ ├── longrunning_pkg2.yaml │ │ ├── multiple_services.proto │ │ ├── multiple_services.yaml │ │ ├── multiple_services_gapic.yaml │ │ ├── multiple_services_pkg2.yaml │ │ ├── my_streaming_proto.proto │ │ ├── my_streaming_proto.yaml │ │ ├── my_streaming_proto_gapic.yaml │ │ ├── my_streaming_proto_pkg2.yaml │ │ ├── myproto.proto │ │ ├── myproto.yaml │ │ ├── no_path_templates.proto │ │ ├── no_path_templates.yaml │ │ ├── no_path_templates_gapic.yaml │ │ ├── no_path_templates_messages.proto │ │ ├── no_path_templates_pkg2.yaml │ │ ├── other_shared_type.proto │ │ ├── samples │ │ │ ├── another_fake.sample.yaml │ │ │ ├── babble_about_book.sample.yaml │ │ │ ├── create_book.sample.yaml │ │ │ ├── delete_shelf.sample.yaml │ │ │ ├── discuss_book.sample.yaml │ │ │ ├── fake.sample.yaml │ │ │ ├── find_related_books.sample.yaml │ │ │ ├── get_big_book.sample.yaml │ │ │ ├── get_big_nothing.sample.yaml │ │ │ ├── get_book.sample.yaml │ │ │ ├── get_book_from_absolutely_anywhere.sample.yaml │ │ │ ├── get_shelf.sample.yaml │ │ │ ├── list_shelves.sample.yaml │ │ │ ├── monolog_about_book.sample.yaml │ │ │ ├── publish_series.sample.yaml │ │ │ ├── stream_books.sample.yaml │ │ │ └── test_optional_required_flattening_params.sample.yaml │ │ ├── shared_type.proto │ │ └── tagger.proto │ ├── protoannotations │ │ ├── another_service.proto │ │ ├── book_from_anywhere.proto │ │ ├── common_resources.proto │ │ ├── different_submodule.proto │ │ ├── errors.proto │ │ ├── field_mask.proto │ │ ├── frozen_dependencies.yaml │ │ ├── library.proto │ │ ├── library.yaml │ │ ├── library_grpc_service_config.json │ │ ├── library_pkg2.yaml │ │ ├── library_rest.proto │ │ ├── library_rest.yaml │ │ ├── library_rest_v2_gapic.yaml │ │ ├── library_v2_gapic.yaml │ │ ├── longrunning.proto │ │ ├── longrunning.yaml │ │ ├── longrunning_gapic.yaml │ │ ├── longrunning_pkg2.yaml │ │ ├── multiple_services.proto │ │ ├── multiple_services.yaml │ │ ├── multiple_services_pkg2.yaml │ │ ├── multiple_services_v2.proto │ │ ├── my_streaming_proto.proto │ │ ├── my_streaming_proto.yaml │ │ ├── my_streaming_proto_pkg2.yaml │ │ ├── myproto.proto │ │ ├── myproto.yaml │ │ ├── no_path_templates.proto │ │ ├── no_path_templates.yaml │ │ ├── no_path_templates_messages.proto │ │ ├── no_path_templates_pkg2.yaml │ │ ├── other_shared_type.proto │ │ ├── samplegen_config_migration_library_gapic.yaml │ │ ├── samples │ │ │ ├── another_fake.sample.yaml │ │ │ ├── babble_about_book.sample.yaml │ │ │ ├── create_book.sample.yaml │ │ │ ├── delete_shelf.sample.yaml │ │ │ ├── discuss_book.sample.yaml │ │ │ ├── fake.sample.yaml │ │ │ ├── find_related_books.sample.yaml │ │ │ ├── get_big_book.sample.yaml │ │ │ ├── get_big_nothing.sample.yaml │ │ │ ├── get_book.sample.yaml │ │ │ ├── get_book_from_absolutely_anywhere.sample.yaml │ │ │ ├── get_shelf.sample.yaml │ │ │ ├── list_shelves.sample.yaml │ │ │ ├── monolog_about_book.sample.yaml │ │ │ ├── publish_series.sample.yaml │ │ │ ├── stream_books.sample.yaml │ │ │ └── test_optional_required_flattening_params.sample.yaml │ │ ├── shared_type.proto │ │ └── tagger.proto │ └── showcase │ │ ├── artman_showcase.yaml │ │ ├── echo.proto │ │ ├── identity.proto │ │ ├── messaging.proto │ │ ├── showcase.yaml │ │ ├── showcase_gapic.yaml │ │ └── testing.proto │ ├── transformer │ ├── InitCodeTransformerTest.java │ ├── ModelTypeNameConverterTestUtil.java │ ├── OutputTransformerTest.java │ ├── RetryDefinitionsTransformerTest.java │ ├── TestCaseTransformerTest.java │ ├── csharp │ │ └── CSharpModelTypeNameConverterTest.java │ ├── go │ │ ├── GoGapicSurfaceTransformerTest.java │ │ ├── GoModelTypeNameConverterTest.java │ │ ├── GoSurfaceNamerTest.java │ │ └── testdata │ │ │ ├── myproto.proto │ │ │ ├── myproto.yaml │ │ │ ├── myproto_gapic.yaml │ │ │ ├── singleservice.proto │ │ │ ├── singleservice.yaml │ │ │ └── singleservice_gapic.yaml │ ├── nodejs │ │ └── NodeJSModelTypeNameConverterTest.java │ ├── php │ │ ├── PhpModelTypeNameConverterTest.java │ │ └── PhpPackageMetadataNamerTest.java │ └── ruby │ │ ├── RubyModelTypeNameConverterTest.java │ │ ├── RubyPackageMetadataNamerTest.java │ │ └── RubySurfaceNamerTest.java │ └── util │ ├── CommonRenderingUtilTest.java │ ├── ConfigValidatorTest.java │ ├── InflectorTest.java │ ├── LicenseHeaderUtilTest.java │ ├── NamePathTest.java │ ├── NameTest.java │ ├── ProtoDocumentLinkTest.java │ ├── ProtoParserTest.java │ ├── ScannerTest.java │ ├── TypeNameTest.java │ ├── VersionParsingTest.java │ ├── go │ └── GoCommentReformatterTest.java │ ├── java │ ├── JavaRenderingUtilTest.java │ └── JavaTypeTableTest.java │ ├── php │ ├── PhpCommentReformatterTest.java │ └── PhpTypeTableTest.java │ └── py │ └── PythonTypeTableTest.java ├── testutils ├── README.md ├── check-baselines.sh ├── check-calling-form-in-baseline │ ├── main.go │ └── main_test.go ├── check-lang-uses-form │ ├── main.go │ └── main_test.go ├── unused-namer.sh └── unused-views.sh └── version.txt /.circleci/artman_config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | local: 3 | # .circleci/config.yml defines the location of the local gapic-generator repo 4 | toolkit: /tmp/workspace/gapic-generator 5 | -------------------------------------------------------------------------------- /.circleci/gapic-generator-it-test.json.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/.circleci/gapic-generator-it-test.json.enc -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners file. 2 | # This file controls who is tagged for review for any given pull request. 3 | # 4 | # For syntax help see: 5 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax 6 | 7 | * @googleapis/actools 8 | -------------------------------------------------------------------------------- /.github/release-please.yml: -------------------------------------------------------------------------------- 1 | releaseType: simple 2 | handleGHRelease: true 3 | -------------------------------------------------------------------------------- /.github/snippet-bot.yml: -------------------------------------------------------------------------------- 1 | aggregateChecks: false 2 | alwaysCreateStatusCheck: false -------------------------------------------------------------------------------- /.github/sync-repo-settings.yaml: -------------------------------------------------------------------------------- 1 | rebaseMergeAllowed: true 2 | squashMergeAllowed: true 3 | mergeCommitAllowed: false 4 | branchProtectionRules: 5 | - pattern: master 6 | isAdminEnforced: true 7 | requiredStatusCheckContexts: 8 | - 'ci/circleci: gapic-generator-bazel-test' 9 | - 'ci/circleci: install-gapic-generator' 10 | - 'ci/circleci: test-baselines' 11 | - 'cla/google' 12 | requiredApprovingReviewCount: 1 13 | requiresCodeOwnerReviews: true 14 | requiresStrictStatusChecks: true 15 | permissionRules: 16 | - team: Googlers 17 | permission: pull 18 | - team: actools 19 | permission: admin 20 | - team: actools-java 21 | permission: push 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build results 2 | bin 3 | build 4 | .gradle 5 | src-gen 6 | bazel-* 7 | env 8 | 9 | # Smoke test artifacts 10 | artman-genfiles 11 | tmp 12 | 13 | # Eclipse 14 | .apt_generated 15 | .classpath 16 | .factorypath 17 | .project 18 | .settings 19 | 20 | # emacs/gEdit autosave files 21 | *~ 22 | 23 | # IntelliJ 24 | .idea 25 | *.iml 26 | *.ipr 27 | *.iws 28 | 29 | # Showcase src directories 30 | showcase-protos 31 | showcase-protos-patched 32 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). 4 | 5 | The Google Security Team will respond within 5 working days of your report on g.co/vulnz. 6 | 7 | We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. 8 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "com_google_api_codegen") 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 | load("//:repository_rules.bzl", "com_google_api_codegen_properties") 5 | 6 | com_google_api_codegen_properties( 7 | name = "com_google_api_codegen_properties", 8 | file = "//:dependencies.properties", 9 | ) 10 | 11 | load("//:repositories.bzl", "com_google_api_codegen_repositories") 12 | 13 | com_google_api_codegen_repositories() 14 | 15 | load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") 16 | 17 | protobuf_deps() 18 | 19 | load( 20 | "@com_google_protoc_java_resource_names_plugin//:repositories.bzl", 21 | "com_google_protoc_java_resource_names_plugin_repositories", 22 | ) 23 | load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") 24 | 25 | switched_rules_by_language( 26 | name = "com_google_googleapis_imports", 27 | ) 28 | 29 | com_google_protoc_java_resource_names_plugin_repositories(omit_com_google_protobuf = True) 30 | 31 | ### Dependencies for buildozer 32 | load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") 33 | go_rules_dependencies() 34 | go_register_toolchains() 35 | -------------------------------------------------------------------------------- /benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | /clients/java/pubsub/target 2 | /clients/php/vendor 3 | /clients/php/composer.lock 4 | -------------------------------------------------------------------------------- /benchmark/clients/php/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "google/cloud-pubsub": "^1.0.0", 4 | "google/gax": "^1.0.0", 5 | "google/proto-client": "^0.40.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /benchmark/server/server.go: -------------------------------------------------------------------------------- 1 | //+build ignore 2 | 3 | package main 4 | 5 | import ( 6 | "flag" 7 | "log" 8 | "net" 9 | 10 | "golang.org/x/net/context" 11 | 12 | pb "google.golang.org/genproto/googleapis/pubsub/v1" 13 | "google.golang.org/grpc" 14 | "google.golang.org/grpc/credentials" 15 | ) 16 | 17 | func main() { 18 | addr := flag.String("a", "localhost:8080", "address") 19 | key := flag.String("key", "", "key file") 20 | cert := flag.String("cert", "", "cert file") 21 | flag.Parse() 22 | 23 | lis, err := net.Listen("tcp", *addr) 24 | if err != nil { 25 | log.Fatal(err) 26 | } 27 | 28 | if *cert == "" || *key == "" { 29 | log.Fatal("need TLS cert and key, for testing you can create your own: https://workaround.org/ispmail/jessie/create-certificate") 30 | } 31 | creds, err := credentials.NewServerTLSFromFile(*cert, *key) 32 | if err != nil { 33 | log.Fatal(err) 34 | } 35 | 36 | gs := grpc.NewServer(grpc.Creds(creds)) 37 | pb.RegisterPublisherServer(gs, &serv{}) 38 | log.Fatal(gs.Serve(lis)) 39 | } 40 | 41 | type serv struct { 42 | pb.PublisherServer 43 | } 44 | 45 | func (*serv) GetTopic(_ context.Context, r *pb.GetTopicRequest) (*pb.Topic, error) { 46 | return &pb.Topic{Name: r.Topic}, nil 47 | } 48 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/Symlinks.groovy: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | class Symlinks { 17 | static createSymbolicLink(String link, String target) { 18 | def linkFile = new File(link) 19 | linkFile.delete() 20 | java.nio.file.Files.createSymbolicLink( 21 | linkFile.toPath(), 22 | new File(target).toPath()) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jul 18 22:46:11 EDT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip 7 | -------------------------------------------------------------------------------- /license-header-javadoc.txt: -------------------------------------------------------------------------------- 1 | /* Copyright 20xx Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "enabled": false 3 | } 4 | -------------------------------------------------------------------------------- /rules_gapic/BUILD.bazel: -------------------------------------------------------------------------------- 1 | package(default_visibility = ["//visibility:public"]) 2 | -------------------------------------------------------------------------------- /rules_gapic/bazel/BUILD.bazel: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "buildozer_binary", 3 | srcs = ["@com_github_bazelbuild_buildtools//buildozer:buildozer"], 4 | outs = ["buildozer.bin"], 5 | cmd = "cp $(location @com_github_bazelbuild_buildtools//buildozer:buildozer) \"$@\" && chmod +x \"$@\"", 6 | ) 7 | 8 | java_binary( 9 | name = "build_file_generator", 10 | srcs = glob(["src/main/java/**/*.java"]), 11 | resources = glob(["src/main/java/**/*.mustache"]), 12 | data = [":buildozer_binary"], 13 | args = ["--buildozer=$(location :buildozer_binary)"], 14 | create_executable = True, 15 | javacopts = ["-source", "1.8", "-target", "1.8"], 16 | jvm_flags = ["-Xmx1024m"], 17 | main_class = "com.google.api.codegen.bazel.BuildFileGenerator", 18 | visibility = ["//visibility:public"], 19 | ) 20 | 21 | java_test( 22 | name = "build_file_generator_test", 23 | srcs = glob(["src/test/java/**/*.java"]), 24 | deps = [":build_file_generator"], 25 | data = glob(["src/test/data/**/*.*"]) + [":buildozer_binary"], 26 | test_class = "com.google.api.codegen.bazel.BuildFileGeneratorTest", 27 | jvm_flags = ["-Dbuildozer=$(location :buildozer_binary)"], 28 | ) 29 | -------------------------------------------------------------------------------- /rules_gapic/bazel/src/main/java/com/google/api/codegen/bazel/BUILD.bazel.root_api.mustache: -------------------------------------------------------------------------------- 1 | exports_files(glob(["*.yaml"])) 2 | -------------------------------------------------------------------------------- /rules_gapic/bazel/src/test/data/buildozer/BUILD.bazel.template: -------------------------------------------------------------------------------- 1 | ## This is a test BUILD.bazel file to validate Buildozer class methods 2 | 3 | some_rule( 4 | name = "rule1", 5 | attr = "attr_value", 6 | to_be_removed_a = "remove_a", 7 | to_be_removed_b = "remove_b", 8 | ) 9 | 10 | some_other_rule( 11 | name = "rule2", 12 | list_attr = [ 13 | "value1", 14 | "value2", 15 | ] 16 | ) 17 | -------------------------------------------------------------------------------- /rules_gapic/bazel/src/test/data/googleapis/google/example/library/BUILD.bazel.baseline: -------------------------------------------------------------------------------- 1 | exports_files(glob(["*.yaml"])) 2 | -------------------------------------------------------------------------------- /rules_gapic/bazel/src/test/data/googleapis/google/example/library/library_example_v1.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 3 3 | name: library-example.googleapis.com 4 | title: Example Library API 5 | 6 | apis: 7 | - name: google.example.library.v1.LibraryService 8 | 9 | documentation: 10 | summary: A simple Google Example Library API. 11 | overview: |- 12 | # Introduction 13 | 14 | This is a Google example service representing a simple digital library. It 15 | manages a collection of shelf resources, and each shelf owns a collection of 16 | book resources. 17 | 18 | backend: 19 | rules: 20 | - selector: google.example.library.v1.LibraryService.CreateShelf 21 | 22 | authentication: 23 | rules: 24 | - selector: 'google.example.library.v1.LibraryService.*' 25 | oauth: 26 | canonical_scopes: |- 27 | https://www.googleapis.com/auth/cloud-platform 28 | -------------------------------------------------------------------------------- /rules_gapic/bazel/src/test/data/googleapis/google/example/library/v1/library_example_grpc_service_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "methodConfig": [ 3 | { 4 | "name": [{"service": "LibraryService"}], 5 | "timeout": "60s" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /rules_gapic/csharp/BUILD.bazel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/csharp/BUILD.bazel -------------------------------------------------------------------------------- /rules_gapic/go/BUILD.bazel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/go/BUILD.bazel -------------------------------------------------------------------------------- /rules_gapic/java/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") 2 | 3 | package(default_visibility = ["//visibility:public"]) 4 | exports_files(glob(["resources/**/*"])) 5 | 6 | pkg_tar( 7 | name = "gradlew", 8 | extension = "tar.gz", 9 | files = { 10 | "resources/gradle/gradle/wrapper/gradle-wrapper.jar": "gradle/wrapper/gradle-wrapper.jar", 11 | "resources/gradle/gradle/wrapper/gradle-wrapper.properties": "gradle/wrapper/gradle-wrapper.properties", 12 | "resources/gradle/gradlew": "gradlew", 13 | "resources/gradle/gradlew.bat": "gradlew.bat", 14 | }, 15 | mode = "644", 16 | modes = { 17 | "gradlew": "555" 18 | }, 19 | ) 20 | -------------------------------------------------------------------------------- /rules_gapic/java/resources/gradle/assembly.gradle.tmpl: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | maven { 5 | url 'https://plugins.gradle.org/m2/' 6 | } 7 | mavenCentral() 8 | } 9 | } 10 | 11 | subprojects { 12 | apply plugin: 'java' 13 | apply plugin: 'maven' 14 | 15 | sourceCompatibility = 1.7 16 | targetCompatibility = 1.7 17 | 18 | test { 19 | testLogging { 20 | events "passed", "skipped", "failed", "standardOut", "standardError" 21 | exceptionFormat = 'full' 22 | } 23 | } 24 | 25 | repositories { 26 | mavenLocal() 27 | mavenCentral() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rules_gapic/java/resources/gradle/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/java/resources/gradle/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /rules_gapic/java/resources/gradle/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon May 02 22:26:16 PDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip 7 | -------------------------------------------------------------------------------- /rules_gapic/java/resources/gradle/grpc.gradle.tmpl: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | } 6 | 7 | apply plugin: 'java' 8 | 9 | description = 'GRPC library for {{name}}' 10 | group = 'com.google.api.grpc' 11 | version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version 12 | sourceCompatibility = 1.7 13 | targetCompatibility = 1.7 14 | 15 | repositories { 16 | mavenCentral() 17 | mavenLocal() 18 | } 19 | 20 | dependencies { 21 | compile 'io.grpc:grpc-stub:{{version.io_grpc}}' 22 | compile 'io.grpc:grpc-protobuf:{{version.io_grpc}}' 23 | {{extra_deps}} 24 | } 25 | 26 | sourceSets { 27 | main { 28 | java { 29 | srcDir 'src/main/java' 30 | } 31 | } 32 | } 33 | 34 | task javadocJar(type: Jar) { 35 | classifier = 'javadoc' 36 | from javadoc 37 | } 38 | 39 | task sourcesJar(type: Jar) { 40 | classifier = 'sources' 41 | from sourceSets.main.allSource 42 | } 43 | 44 | artifacts { 45 | archives javadocJar, sourcesJar 46 | } 47 | 48 | compileJava.options.encoding = 'UTF-8' 49 | javadoc.options.encoding = 'UTF-8' 50 | -------------------------------------------------------------------------------- /rules_gapic/java/resources/gradle/proto.gradle.tmpl: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | } 6 | 7 | apply plugin: 'java' 8 | 9 | description = 'PROTO library for {{name}}' 10 | group = 'com.google.api.grpc' 11 | version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version 12 | sourceCompatibility = 1.7 13 | targetCompatibility = 1.7 14 | 15 | repositories { 16 | mavenCentral() 17 | mavenLocal() 18 | } 19 | 20 | dependencies { 21 | compile 'com.google.protobuf:protobuf-java:{{version.com_google_protobuf}}' 22 | compile '{{maven.com_google_api_api_common}}' 23 | compile '{{maven.com_google_api_grpc_proto_google_common_protos}}' 24 | {{extra_deps}} 25 | } 26 | 27 | sourceSets { 28 | main { 29 | resources { 30 | srcDir 'src/main/proto' 31 | } 32 | java { 33 | srcDir 'src/main/java' 34 | } 35 | } 36 | } 37 | 38 | task javadocJar(type: Jar) { 39 | classifier = 'javadoc' 40 | from javadoc 41 | } 42 | 43 | task sourcesJar(type: Jar) { 44 | classifier = 'sources' 45 | from sourceSets.main.allSource 46 | } 47 | 48 | artifacts { 49 | archives javadocJar, sourcesJar 50 | } 51 | 52 | compileJava.options.encoding = 'UTF-8' 53 | javadoc.options.encoding = 'UTF-8' 54 | -------------------------------------------------------------------------------- /rules_gapic/java/resources/gradle/settings.gradle.tmpl: -------------------------------------------------------------------------------- 1 | include rootDir.listFiles().findAll { 2 | it.isDirectory() && !(it =~ ".*/\\..*") && !(it =~ "^\\..*") 3 | }.collect { 4 | it.getName() 5 | }. toArray(new String[0]) 6 | 7 | 8 | -------------------------------------------------------------------------------- /rules_gapic/nodejs/BUILD.bazel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/nodejs/BUILD.bazel -------------------------------------------------------------------------------- /rules_gapic/php/BUILD.bazel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/php/BUILD.bazel -------------------------------------------------------------------------------- /rules_gapic/php/resources/php-7.1.30_linux_x86_64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/php/resources/php-7.1.30_linux_x86_64.tar.gz -------------------------------------------------------------------------------- /rules_gapic/python/BUILD.bazel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/python/BUILD.bazel -------------------------------------------------------------------------------- /rules_gapic/ruby/BUILD.bazel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/rules_gapic/ruby/BUILD.bazel -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'gapic-generator' 2 | -------------------------------------------------------------------------------- /showcase/java/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea/ 3 | .gradle 4 | .vscode 5 | /local.properties 6 | 7 | .project 8 | .settings 9 | .classpath 10 | 11 | .DS_Store 12 | /bin 13 | /build 14 | /captures 15 | .externalNativeBuild 16 | -------------------------------------------------------------------------------- /showcase/java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/showcase/java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /showcase/java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2018 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | #Mon Aug 27 16:47:59 PDT 2018 18 | distributionBase=GRADLE_USER_HOME 19 | distributionPath=wrapper/dists 20 | zipStoreBase=GRADLE_USER_HOME 21 | zipStorePath=wrapper/dists 22 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip 23 | -------------------------------------------------------------------------------- /showcase/java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | rootProject.name = 'showcase-java' 18 | -------------------------------------------------------------------------------- /showcase/java/src/test/java/com/google/api/showcase/ShowcaseHeaderProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.api.showcase; 18 | 19 | import com.google.api.gax.rpc.HeaderProvider; 20 | import java.util.Collections; 21 | import java.util.Map; 22 | 23 | /** Header provider for the showcase tests */ 24 | public class ShowcaseHeaderProvider implements HeaderProvider { 25 | 26 | @Override 27 | public Map getHeaders() { 28 | return Collections.emptyMap(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /showcase/nodejs/.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | node_modules 3 | -------------------------------------------------------------------------------- /showcase/nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "showcase-integration", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "test": "mocha index.js", 6 | "browser-test": "karma start" 7 | }, 8 | "dependencies": { 9 | "showcase": "file:../../artman-genfiles/js/showcase-v1beta1", 10 | "@grpc/grpc-js": "^1.0.0", 11 | "grpc": "^1.23.3", 12 | "is-docker": "^3.0.0", 13 | "karma": "^5.0.0", 14 | "karma-chrome-launcher": "^3.1.0", 15 | "karma-mocha": "^2.0.0", 16 | "karma-webpack": "^4.0.2", 17 | "mocha": "^8.0.0", 18 | "null-loader": "^4.0.0", 19 | "puppeteer": "^5.0.0", 20 | "webpack": "^4.39.3", 21 | "webpack-cli": "^3.3.7" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /showcase/nodejs/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | entry: './index.js', 5 | output: { 6 | library: "showcaseTest", 7 | filename: "./main.js" 8 | }, 9 | node: { 10 | child_process: 'empty', 11 | fs: 'empty', 12 | crypto: 'empty', 13 | }, 14 | resolve: { 15 | extensions: ['.js', '.json'] 16 | }, 17 | module: { 18 | rules: [ 19 | { 20 | test: /node_modules[\\\/]@grpc[\\\/]grpc-js/, 21 | use: 'null-loader' 22 | }, 23 | { 24 | test: /node_modules[\\\/]grpc/, 25 | use: 'null-loader' 26 | }, 27 | { 28 | test: /node_modules[\\\/]retry-request/, 29 | use: 'null-loader' 30 | }, 31 | { 32 | test: /node_modules[\\\/]https-proxy-agent/, 33 | use: 'null-loader' 34 | }, 35 | { 36 | test: /node_modules[\\\/]gtoken/, 37 | use: 'null-loader' 38 | }, 39 | ] 40 | }, 41 | mode: 'production' 42 | } 43 | -------------------------------------------------------------------------------- /showcase/php/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "repositories": [ 3 | { 4 | "type": "path", 5 | "url": "../../artman-genfiles/php/google-cloud-showcase-v1beta1" 6 | } 7 | ], 8 | "minimum-stability": "dev", 9 | "prefer-stable": true, 10 | "require": { 11 | "google/showcase": "*" 12 | }, 13 | "require-dev": { 14 | "phpunit/phpunit": "^4.8|^5.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /showcase/php/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | tests 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /showcase/python/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | .nox 3 | .pytest_cache 4 | -------------------------------------------------------------------------------- /showcase/ruby/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "google-showcase", "~> 0.1.0" 4 | gem "minitest", "~> 5.10" 5 | gem "google-gax", "~> 1.6" 6 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/clientconfig/ClientConfigSnippetSet.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.clientconfig; 16 | 17 | import com.google.api.tools.framework.snippet.Doc; 18 | 19 | /** Entry points for a client config snippet set. */ 20 | interface ClientConfigSnippetSet { 21 | 22 | /** Generates the result filename for the generated document. */ 23 | Doc generateFilename(Element service); 24 | 25 | /** Generates the body of the config for the service interface. */ 26 | Doc generateBody(Element service); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/common/TargetLanguage.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.common; 16 | 17 | /** Target languages supported by the code generators */ 18 | public enum TargetLanguage { 19 | CSHARP, 20 | GO, 21 | JAVA, 22 | NODEJS, 23 | PHP, 24 | PYTHON, 25 | RUBY; 26 | 27 | public static TargetLanguage fromString(String language) { 28 | return Enum.valueOf(TargetLanguage.class, language.toUpperCase()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/config/GenericFieldSelector.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.config; 16 | 17 | /** API source-agnostic interface for FieldSelectors. */ 18 | public interface GenericFieldSelector { 19 | 20 | String getParamName(); 21 | 22 | FieldModel getLastField(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/config/InterfaceModel.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.config; 16 | 17 | import java.util.List; 18 | 19 | /** API-source-agnostic wrapper classes for Interfaces. */ 20 | public interface InterfaceModel { 21 | 22 | /* @return the Model from which this interface came from. */ 23 | ApiModel getApiModel(); 24 | 25 | String getSimpleName(); 26 | 27 | String getFullName(); 28 | 29 | String getParentFullName(); 30 | 31 | String getFileSimpleName(); 32 | 33 | List getMethods(); 34 | 35 | /* @return true if the element is reachable with the current scoper. */ 36 | boolean isReachable(); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/config/OneofConfig.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.config; 16 | 17 | import com.google.api.codegen.util.Name; 18 | import com.google.api.tools.framework.model.MessageType; 19 | import com.google.auto.value.AutoValue; 20 | 21 | @AutoValue 22 | public abstract class OneofConfig { 23 | public abstract Name groupName(); 24 | 25 | public abstract MessageType parentType(); 26 | 27 | public abstract FieldModel field(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/config/ProductConfig.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.config; 16 | 17 | import com.google.common.collect.ImmutableList; 18 | 19 | /** ProductConfig represents client code-gen config for an API product in an input-agnostic way. */ 20 | public interface ProductConfig { 21 | 22 | String getPackageName(); 23 | 24 | ImmutableList getCopyrightLines(); 25 | 26 | ImmutableList getLicenseLines(); 27 | 28 | InterfaceConfig getInterfaceConfig(InterfaceModel interfaceModel); 29 | 30 | boolean hasInterfaceConfig(InterfaceModel interfaceModel); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/config/TransportProtocol.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.config; 16 | 17 | /* The type of transport protocol used by the generated surface. */ 18 | public enum TransportProtocol { 19 | GRPC, 20 | HTTP 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/config/VersionBound.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.config; 16 | 17 | import com.google.auto.value.AutoValue; 18 | import javax.annotation.Nullable; 19 | 20 | /** 21 | * VersionBound represents bounds on a version for a dependency specified in the 22 | * PackageMetadataConfig. 23 | */ 24 | @AutoValue 25 | public abstract class VersionBound { 26 | public abstract String lower(); 27 | 28 | @Nullable 29 | public abstract String upper(); 30 | 31 | public static VersionBound create(String lower, String upper) { 32 | return new AutoValue_VersionBound(lower, upper); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/InterfaceTransformer.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen; 16 | 17 | import com.google.api.codegen.config.InterfaceModel; 18 | import java.util.Map; 19 | 20 | /** Generates API source specific interface data. */ 21 | public interface InterfaceTransformer { 22 | /** 23 | * Examines all of the resource paths used by the given apiInterface, and returns a map from each 24 | * unique resource paths to a short name used by the collection configuration. 25 | */ 26 | Map getResourceToEntityNameMap(InterfaceModel apiInterface); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/MethodTransformer.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen; 16 | 17 | import com.google.api.codegen.config.MethodModel; 18 | import java.util.List; 19 | 20 | /** Generates API source specific method data. */ 21 | public interface MethodTransformer { 22 | boolean isIgnoredParameter(String parameter); 23 | 24 | String getTimeoutMillis(MethodModel method); 25 | 26 | List getParameterList(MethodModel method); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/PageStreamingTransformer.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen; 16 | 17 | import com.google.api.codegen.config.MethodModel; 18 | import com.google.api.codegen.configgen.nodes.ConfigNode; 19 | 20 | /** Generates API source specific page streaming nodes. */ 21 | public interface PageStreamingTransformer { 22 | String getNameForPageToken(); 23 | 24 | String getNameForPageSize(); 25 | 26 | ConfigNode generateResponseValueNode( 27 | ConfigNode parentNode, MethodModel method, ConfigHelper helper); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/README.md: -------------------------------------------------------------------------------- 1 | ## Gapic Config Generation 2 | 3 | Generates the gapic config. For discovery, generation uses MVVM. Normal 4 | generation uses `ConfigNode`s. 5 | 6 | The purpose of the `ConfigNode`s is to preserve comments when refreshing the 7 | gapic config. Linked nodes allow easy insertion and replacement of any node. 8 | 9 | Different node types indicate what the `NodeVisitor` should do for a visited 10 | node. Nodes can have metadata, such as `Comment`s, that annotate and change the 11 | behavior of a node depending on how the `NodeVisitor` interprets it. 12 | 13 | The mergers combine the `Model` with a `ConfigNode` to output a `ConfigNode` 14 | that represents the IDL. For initial gapic config generation, the input node is 15 | empty. When refreshing, the node will be read from an existing gapic yaml. 16 | 17 | To generate the yaml, a `ConfigGenerator` visits each node and builds the 18 | output. 19 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/nodes/ScalarConfigNode.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen.nodes; 16 | 17 | /** 18 | * Represents plain text in a gapic config. 19 | * 20 | *

Can represent a comment if the text starts with "#". 21 | */ 22 | public class ScalarConfigNode extends BaseConfigNode { 23 | public ScalarConfigNode(int startLine, String text) { 24 | super(startLine, text); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/nodes/metadata/Comment.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen.nodes.metadata; 16 | 17 | /** Represents comment metadata for a ConfigNode. */ 18 | public interface Comment { 19 | /** Generates the String representation of this. */ 20 | String generate(); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/nodes/metadata/DefaultComment.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen.nodes.metadata; 16 | 17 | /** Base comment to be wrapped by decorators. Outputs its String. */ 18 | public class DefaultComment implements Comment { 19 | 20 | private final String comment; 21 | 22 | public DefaultComment(String comment) { 23 | this.comment = comment; 24 | } 25 | 26 | @Override 27 | public String generate() { 28 | return comment; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/nodes/metadata/FixmeComment.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen.nodes.metadata; 16 | 17 | /** Comment decorator that adds a FIXME heading. */ 18 | public class FixmeComment implements Comment { 19 | private final Comment comment; 20 | 21 | public FixmeComment(String comment) { 22 | this(new DefaultComment(comment)); 23 | } 24 | 25 | public FixmeComment(Comment comment) { 26 | this.comment = comment; 27 | } 28 | 29 | @Override 30 | public String generate() { 31 | String text = comment.generate(); 32 | return text.isEmpty() ? "" : "FIXME: " + text; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/configgen/nodes/metadata/NullComment.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.configgen.nodes.metadata; 16 | 17 | /** Implements the Null Object Pattern for Comment. */ 18 | public class NullComment implements Comment { 19 | @Override 20 | public String generate() { 21 | return ""; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/discovery/Node.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.discovery; 16 | 17 | import javax.annotation.Nullable; 18 | 19 | /** Represents a node in a tree of nodes. */ 20 | public interface Node { 21 | /** @return the ID of this node. */ 22 | @Nullable 23 | String id(); 24 | 25 | /** @return the immediate parent of this node. */ 26 | @Nullable 27 | Node parent(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/gapic/PackageNameCodePathMapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.gapic; 16 | 17 | import com.google.api.codegen.config.ProductConfig; 18 | 19 | /** An implementation of GapicCodePathMapper where the output path is simply the package name. */ 20 | public class PackageNameCodePathMapper implements GapicCodePathMapper { 21 | @Override 22 | public String getOutputPath(String elementFullName, ProductConfig config) { 23 | return config.getPackageName(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/gapic/ServiceMessages.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.gapic; 16 | 17 | import com.google.api.tools.framework.model.TypeRef; 18 | import com.google.protobuf.Empty; 19 | 20 | /** Utility class with methods to work with service methods. */ 21 | public class ServiceMessages { 22 | 23 | /** Returns true if the message is the empty message. */ 24 | public boolean isEmptyType(TypeRef type) { 25 | return s_isEmptyType(type); 26 | } 27 | 28 | public static boolean s_isEmptyType(TypeRef type) { 29 | return type.isMessage() 30 | && type.getMessageType().getFullName().equals(Empty.getDescriptor().getFullName()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/metacode/InitCodeLineType.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.metacode; 16 | 17 | /** InitCodeLineType represents one of the types of InitCodeLine. */ 18 | public enum InitCodeLineType { 19 | StructureInitLine, 20 | ListInitLine, 21 | SimpleInitLine, 22 | MapInitLine, 23 | ReadFileInitLine, 24 | Unknown 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/nodejs/NodeJSUtils.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.nodejs; 16 | 17 | import com.google.api.codegen.config.GapicProductConfig; 18 | 19 | public class NodeJSUtils { 20 | /** 21 | * Returns true if the current API is a part of gcloud (i.e. cloud API). This can be known if the 22 | * domain_layer_location is "google-cloud". 23 | */ 24 | public static boolean isGcloud(GapicProductConfig config) { 25 | return "google-cloud".equals(config.getDomainLayerLocation()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/packagegen/PackageGenerator.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.packagegen; 16 | 17 | import com.google.api.codegen.common.GeneratedResult; 18 | import com.google.api.codegen.config.PackageMetadataConfig; 19 | import com.google.api.tools.framework.model.Model; 20 | import java.io.IOException; 21 | import java.util.Map; 22 | 23 | /** Generates package metadata. */ 24 | public interface PackageGenerator { 25 | Map> generate(Model model, PackageMetadataConfig config) 26 | throws IOException; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/transformer/Synchronicity.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.transformer; 16 | 17 | /** Specifies synchronous or asynchronous. */ 18 | public enum Synchronicity { 19 | Sync, 20 | Async, 21 | GrpcStreaming 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/transformer/TransformationContext.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.transformer; 16 | 17 | import com.google.api.codegen.config.ProductConfig; 18 | 19 | /** 20 | * The context for transforming an API model, in an input-agnostic way, into a view model to use for 21 | * client library generation. 22 | */ 23 | public interface TransformationContext { 24 | 25 | ProductConfig getProductConfig(); 26 | 27 | SurfaceNamer getNamer(); 28 | 29 | ImportTypeTable getImportTypeTable(); 30 | 31 | TransformationContext withNewTypeTable(); 32 | 33 | TransformationContext withNewTypeTable(String newPackageName); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/transformer/csharp/CSharpFeatureConfig.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.transformer.csharp; 16 | 17 | import com.google.api.codegen.transformer.DefaultFeatureConfig; 18 | 19 | public class CSharpFeatureConfig extends DefaultFeatureConfig { 20 | @Override 21 | public boolean enableMixins() { 22 | return true; 23 | } 24 | 25 | @Override 26 | public boolean resourceNameTypesEnabled() { 27 | return true; 28 | } 29 | 30 | @Override 31 | public boolean resourceNameProtoAccessorsEnabled() { 32 | return resourceNameTypesEnabled(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/transformer/nodejs/NodeJSFeatureConfig.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.transformer.nodejs; 16 | 17 | import com.google.api.codegen.transformer.DefaultFeatureConfig; 18 | 19 | public class NodeJSFeatureConfig extends DefaultFeatureConfig { 20 | @Override 21 | public boolean enableMixins() { 22 | return true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/transformer/ruby/RubyFeatureConfig.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.transformer.ruby; 16 | 17 | import com.google.api.codegen.transformer.DefaultFeatureConfig; 18 | 19 | public class RubyFeatureConfig extends DefaultFeatureConfig { 20 | @Override 21 | public boolean enableMixins() { 22 | return true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/CommentReformatter.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util; 16 | 17 | public interface CommentReformatter { 18 | /** Reformats the given comment to match a language comment format */ 19 | String reformat(String comment); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/ImportType.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util; 16 | 17 | public enum ImportType { 18 | SimpleImport, 19 | StaticImport, 20 | AliasedImport, 21 | OuterImport 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/StringUtil.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util; 16 | 17 | public class StringUtil { 18 | 19 | /** TODO Do this operation in a more general way in the Name class */ 20 | public static String removeSuffix(String original, String suffix) { 21 | if (original.endsWith(suffix)) { 22 | original = original.substring(0, original.length() - suffix.length()); 23 | } 24 | return original; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/VersionMatcher.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util; 16 | 17 | import java.util.regex.Pattern; 18 | 19 | public class VersionMatcher { 20 | private static final Pattern VERSION_PATTERN = 21 | Pattern.compile( 22 | "^([vV]\\d+)" // Major version eg: v1 23 | + "([pP_]\\d+)?" // Point release eg: p2 24 | + "(([aA]lpha|[bB]eta)\\d*)?"); // Release level eg: alpha3 25 | 26 | public static boolean isVersion(String str) { 27 | return VERSION_PATTERN.matcher(str).matches(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/csharp/CSharpAliasMode.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.google.api.codegen.util.csharp; 17 | 18 | public enum CSharpAliasMode { 19 | Global, 20 | MessagesOnly, 21 | Off 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/csharp/CSharpRenderingUtil.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util.csharp; 16 | 17 | public class CSharpRenderingUtil {} 18 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/csharp/README.md: -------------------------------------------------------------------------------- 1 | # C# utils 2 | 3 | This directory contains C# utilities. 4 | 5 | ## CSharpImports.java 6 | 7 | CSharpImports.java is an auto-generated file, 8 | used for C# only. 9 | 10 | The generator has to be written in C# because 11 | it queries C# namespaces for lists of types. 12 | 13 | The generator is in the Google C# cloud repo: 14 | https://github.com/GoogleCloudPlatform/google-cloud-dotnet/tree/master/tools/Google.Cloud.Tools.GenerateTypeNamesToAlias 15 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/py/PythonCommentReformatter.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util.py; 16 | 17 | import com.google.api.codegen.util.CommentReformatter; 18 | 19 | // Python comment transformation occurs in the descriptor set, before calling 20 | // gapic-generator, so this class does not modify the comments at all. 21 | public class PythonCommentReformatter implements CommentReformatter { 22 | @Override 23 | public String reformat(String comment) { 24 | return comment; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/py/PythonDocstringUtil.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util.py; 16 | 17 | public class PythonDocstringUtil { 18 | public static String napoleonType(String fullName, String typesFileNamespace) { 19 | if (fullName.contains(".")) { 20 | String typeName = fullName.substring(fullName.lastIndexOf('.') + 1); 21 | return String.format("~%s.types.%s", typesFileNamespace, typeName); 22 | } 23 | return ":class:`" + fullName + "`"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/util/testing/ValueProducer.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.util.testing; 16 | 17 | import com.google.api.codegen.config.TypeModel; 18 | import com.google.api.codegen.util.Name; 19 | 20 | /** A utility interface used by TestValueGenerator. */ 21 | public interface ValueProducer { 22 | String produce(TypeModel typeRef, Name identifier); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/ApiMethodView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | import java.util.List; 18 | 19 | public interface ApiMethodView { 20 | String name(); 21 | 22 | interface Builder { 23 | ApiMethodView.Builder initCode(InitCodeView val); 24 | 25 | ApiMethodView.Builder samples(List samples); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/BatchingPartitionKeyView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | import com.google.auto.value.AutoValue; 18 | 19 | @AutoValue 20 | public abstract class BatchingPartitionKeyView { 21 | 22 | public abstract String fieldGetFunction(); 23 | 24 | public static Builder newBuilder() { 25 | return new AutoValue_BatchingPartitionKeyView.Builder(); 26 | } 27 | 28 | @AutoValue.Builder 29 | public abstract static class Builder { 30 | 31 | public abstract Builder fieldGetFunction(String val); 32 | 33 | public abstract BatchingPartitionKeyView build(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/GrpcElementDocView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | public interface GrpcElementDocView { 18 | String name(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/HttpMethodSelectorView.java: -------------------------------------------------------------------------------- 1 | package com.google.api.codegen.viewmodel; 2 | 3 | import com.google.auto.value.AutoValue; 4 | import java.util.List; 5 | 6 | @AutoValue 7 | public abstract class HttpMethodSelectorView { 8 | public abstract String fullyQualifiedName(); 9 | 10 | public abstract List gettersChain(); 11 | 12 | public abstract List gettersHasChain(); 13 | 14 | public boolean isProto3Optional() { 15 | return !gettersHasChain().isEmpty(); 16 | } 17 | 18 | public static HttpMethodSelectorView.Builder newBuilder() { 19 | return new AutoValue_HttpMethodSelectorView.Builder(); 20 | } 21 | 22 | @AutoValue.Builder 23 | public abstract static class Builder { 24 | public abstract Builder fullyQualifiedName(String val); 25 | 26 | public abstract Builder gettersChain(List val); 27 | 28 | public abstract Builder gettersHasChain(List val); 29 | 30 | public abstract HttpMethodSelectorView build(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/InitCodeLineView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | import com.google.api.codegen.metacode.InitCodeLineType; 18 | 19 | public interface InitCodeLineView { 20 | InitCodeLineType lineType(); 21 | 22 | String identifier(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/InitValueView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | public interface InitValueView {} 18 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/ParamDocView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | public interface ParamDocView {} 18 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/PathTemplateView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | import com.google.auto.value.AutoValue; 18 | 19 | @AutoValue 20 | public abstract class PathTemplateView { 21 | public abstract String name(); 22 | 23 | public abstract String pattern(); 24 | 25 | public static Builder newBuilder() { 26 | return new AutoValue_PathTemplateView.Builder(); 27 | } 28 | 29 | @AutoValue.Builder 30 | public abstract static class Builder { 31 | public abstract Builder name(String val); 32 | 33 | public abstract Builder pattern(String val); 34 | 35 | public abstract PathTemplateView build(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/ResourceNameType.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | public enum ResourceNameType { 18 | SINGLE, 19 | FIXED, 20 | ONEOF, 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/ResourceNameView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | public interface ResourceNameView { 18 | public ResourceNameType type(); 19 | 20 | public String typeName(); 21 | 22 | public String paramName(); 23 | 24 | public String propertyName(); 25 | 26 | public String enumName(); 27 | 28 | public String docName(); 29 | 30 | public int index(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/ServiceMethodType.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | /** The type of the underlying method in the service API. */ 18 | public enum ServiceMethodType { 19 | UnaryMethod, 20 | GrpcBidiStreamingMethod, 21 | GrpcClientStreamingMethod, 22 | GrpcServerStreamingMethod, 23 | LongRunningMethod 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/ViewModel.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel; 16 | 17 | /** Represents a node of a view model that can be rendered by a template engine. */ 18 | public interface ViewModel { 19 | 20 | String resourceRoot(); 21 | 22 | String templateFileName(); 23 | 24 | String outputPath(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/metadata/ModuleView.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package com.google.api.codegen.viewmodel.metadata; 17 | 18 | public interface ModuleView {} 19 | -------------------------------------------------------------------------------- /src/main/java/com/google/api/codegen/viewmodel/metadata/VersionIndexType.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.viewmodel.metadata; 16 | 17 | public enum VersionIndexType { 18 | Unspecified, 19 | VersionIndex, 20 | TopLevelIndex 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/clientconfig/json.snip: -------------------------------------------------------------------------------- 1 | @extends "common.snip" 2 | @extends "clientconfig/common.snip" 3 | 4 | @snippet generateFilename(service) 5 | {@context.upperCamelToLowerUnderscore(service.getSimpleName)}_client_config.json 6 | @end 7 | 8 | @snippet generateBody(service) 9 | { 10 | {@clientConfig(service)} 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/clientconfig/python_clientconfig.snip: -------------------------------------------------------------------------------- 1 | @extends "common.snip" 2 | @extends "clientconfig/common.snip" 3 | 4 | @snippet generateFilename(service) 5 | {@context.upperCamelToLowerUnderscore(service.getSimpleName)}_client_config.py 6 | @end 7 | 8 | @snippet generateBody(service) 9 | config = { 10 | {@clientConfig(service)} 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/copyright-google.txt: -------------------------------------------------------------------------------- 1 | Copyright 2020 Google LLC 2 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/csharp/client.snip: -------------------------------------------------------------------------------- 1 | @snippet syncClient(apiMethod) 2 | {@apiMethod.apiClassName} {@apiMethod.apiVariableName} = \ 3 | {@apiMethod.apiClassName}.Create(); 4 | @end 5 | 6 | @snippet asyncClient(apiMethod) 7 | {@apiMethod.apiClassName} {@apiMethod.apiVariableName} = await \ 8 | {@apiMethod.apiClassName}.CreateAsync(); 9 | @end 10 | 11 | @snippet commaSeparatedArgAndTypes(args) 12 | @join arg : args on ", " 13 | {@arg.typeName} {@arg.identifier} 14 | @end 15 | @end 16 | 17 | @snippet syncSampleFunction(sample) 18 | public static void {@sample.sampleFunctionName}({@commaSeparatedArgAndTypes(sample.sampleInitCode.argDefaultParams)}) 19 | @end 20 | 21 | @snippet asyncSampleFunction(sample) 22 | public static async Task {@sample.sampleFunctionName}Async({@commaSeparatedArgAndTypes(sample.sampleInitCode.argDefaultParams)}) 23 | @end 24 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/csharp/gapic_samples_csproj.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(sample) 2 | 3 | 4 | 5 | 6 | netcoreapp2.1 7 | Exe 8 | latest 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/csharp/gapic_samples_program.snip: -------------------------------------------------------------------------------- 1 | @extends "csharp/common.snip" 2 | 3 | @snippet generate(sampleEntryPoint) 4 | {@initialComments(sampleEntryPoint.fileHeader)} 5 | 6 | using Google.Cloud.SampleUtil; 7 | 8 | namespace {@sampleEntryPoint.fileHeader.packageName}.Samples 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) => ApplicationChooser.Run(args); 13 | } 14 | } 15 | 16 | @end -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/csharp/gapic_smoketest_csproj.snip: -------------------------------------------------------------------------------- 1 | # smoke: SmokeTestClassView 2 | @snippet generate(smoke) 3 | 4 | 5 | 6 | 7 | netcoreapp1.0 8 | Exe 9 | latest 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/csharp/gapic_snippets_csproj.snip: -------------------------------------------------------------------------------- 1 | # snippets: SnippetsFileView 2 | @snippet generate(snippets) 3 | 4 | 5 | 6 | 7 | netcoreapp1.0;netcoreapp2.0;net452 8 | netcoreapp1.0;netcoreapp2.0 9 | latest 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/csharp/gapic_unittest_csproj.snip: -------------------------------------------------------------------------------- 1 | # test: TestClassView 2 | @snippet generate(test) 3 | 4 | 5 | 6 | 7 | netcoreapp1.0;netcoreapp2.0;net452 8 | netcoreapp1.0;netcoreapp2.0 9 | latest 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/go/header.snip: -------------------------------------------------------------------------------- 1 | @snippet headerComment(fileHeader) 2 | @join line : fileHeader.copyrightLines 3 | // {@line} 4 | @end 5 | 6 | // 7 | @join line : fileHeader.licenseLines 8 | // {@line} 9 | @end 10 | 11 | // Code generated by gapic-generator. DO NOT EDIT. 12 | @end 13 | 14 | @snippet renderImportSection(importSection) 15 | @if importSection.standardImports 16 | {@imports(importSection.standardImports)} 17 | 18 | 19 | @end 20 | {@imports(importSection.externalImports)} 21 | @end 22 | 23 | @private imports(fileImports) 24 | @join fileImport : fileImports 25 | @join import : fileImport.types 26 | @if import.nickname 27 | {@import.nickname} {@import.fullName} 28 | @else 29 | {@import.fullName} 30 | @end 31 | @end 32 | @end 33 | @end 34 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/java/build_gapic_samples.gradle.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | buildscript { 3 | repositories { 4 | mavenCentral() 5 | } 6 | } 7 | 8 | apply plugin: 'java' 9 | apply plugin: 'application' 10 | 11 | description = 'GAPIC samples for {@metadata.identifier}' 12 | group = 'com.google.cloud' 13 | version = (findProperty('version') == 'unspecified') ? '0.0.0-SNAPSHOT' : version 14 | sourceCompatibility = 1.7 15 | targetCompatibility = 1.7 16 | 17 | repositories { 18 | mavenCentral() 19 | mavenLocal() 20 | } 21 | 22 | compileJava.options.encoding = 'UTF-8' 23 | javadoc.options.encoding = 'UTF-8' 24 | 25 | dependencies { 26 | @join dep : metadata.additionalDependencies 27 | compile '{@dep.group}:{@dep.name}:{@dep.versionBound.lower}' 28 | @end 29 | compile project(':gapic-{@metadata.identifier}') 30 | } 31 | 32 | task fatJar(type: Jar) { 33 | baseName = 'sample-{@metadata.identifier}-all' 34 | from { 35 | configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 36 | } 37 | with jar 38 | } 39 | 40 | clean { 41 | delete 'all-jars' 42 | } 43 | 44 | run { 45 | mainClassName = getProperty('mainClass') 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/java/mock_service.snip: -------------------------------------------------------------------------------- 1 | @extends "java/common.snip" 2 | 3 | @snippet generate(mockService) 4 | {@renderFileHeader(mockService.fileHeader)} 5 | 6 | @@javax.annotation.Generated("by GAPIC") 7 | @@BetaApi 8 | public class {@mockService.name} implements MockGrpcService { 9 | private final {@mockService.serviceImplClassName} serviceImpl; 10 | 11 | public {@mockService.name}() { 12 | serviceImpl = new {@mockService.serviceImplClassName}(); 13 | } 14 | 15 | @@Override 16 | public List getRequests() { 17 | return serviceImpl.getRequests(); 18 | } 19 | 20 | @@Override 21 | public void addResponse(AbstractMessage response) { 22 | serviceImpl.addResponse(response); 23 | } 24 | 25 | @@Override 26 | public void addException(Exception exception) { 27 | serviceImpl.addException(exception); 28 | } 29 | 30 | @@Override 31 | public ServerServiceDefinition getServiceDefinition() { 32 | return serviceImpl.bindService(); 33 | } 34 | 35 | @@Override 36 | public void reset() { 37 | serviceImpl.reset(); 38 | } 39 | } 40 | @end 41 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/java/resource_name_factory.snip: -------------------------------------------------------------------------------- 1 | @extends "java/common.snip" 2 | @extends "java/method_sample.snip" 3 | 4 | @snippet generate(apiFile) 5 | {@renderFileHeader(apiFile.fileHeader)} 6 | 7 | @@Generated("by GAPIC") 8 | @@BetaApi 9 | {@nameClassDef(apiFile)} 10 | @end 11 | 12 | @private nameClassDef(factory) 13 | public final class {@factory.name} implements ResourceNameFactory { 14 | {@interfaceMethods(factory)} 15 | } 16 | 17 | @end 18 | 19 | @private interfaceMethods(factory) 20 | @@Override 21 | public {@factory.resourceNameTypeName} parse(String formattedString) { 22 | return {@factory.resourceNameTypeName}.parse(formattedString); 23 | } 24 | @end 25 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/java/static/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | maven { 5 | url 'https://plugins.gradle.org/m2/' 6 | } 7 | mavenCentral() 8 | } 9 | } 10 | 11 | subprojects { 12 | apply plugin: 'java' 13 | apply plugin: 'maven' 14 | 15 | sourceCompatibility = 1.7 16 | targetCompatibility = 1.7 17 | 18 | test { 19 | testLogging { 20 | events "passed", "skipped", "failed", "standardOut", "standardError" 21 | exceptionFormat = 'full' 22 | } 23 | } 24 | 25 | repositories { 26 | mavenLocal() 27 | mavenCentral() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/java/static/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/gapic-generator/724707188c37aff62bf7bb11faa112a5d7a85e01/src/main/resources/com/google/api/codegen/java/static/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/java/static/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon May 02 22:26:16 PDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip 7 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/java/static/settings.gradle: -------------------------------------------------------------------------------- 1 | include rootDir.listFiles().findAll { 2 | it.isDirectory() && !(it ==~ ".*/\\..*") && !(it ==~ "^\\..*") 3 | }.collect { 4 | it.getName() 5 | }.toArray(new String[0]) 6 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/license-header-apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Licensed under the Apache License, Version 2.0 (the "License"); 2 | you may not use this file except in compliance with the License. 3 | You may obtain a copy of the License at 4 | 5 | https://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/java/grpc/build_grpc.gradle.snip: -------------------------------------------------------------------------------- 1 | @extends "metadatagen/java/grpc/build_base.gradle.snip" 2 | 3 | @override description(metadata) 4 | 'GRPC library for {@metadata.identifier}' 5 | @end 6 | 7 | @override dependencies(metadata) 8 | compile 'io.grpc:grpc-stub:{@metadata.grpcVersionBound.lower}' 9 | compile 'io.grpc:grpc-protobuf:{@metadata.grpcVersionBound.lower}' 10 | compile project(':{@metadata.protoPackageName}') 11 | @end 12 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/java/grpc/build_protobuf.gradle.snip: -------------------------------------------------------------------------------- 1 | @extends "metadatagen/java/grpc/build_base.gradle.snip" 2 | 3 | @override description(metadata) 4 | 'PROTO library for {@metadata.identifier}' 5 | @end 6 | 7 | @override dependencies(metadata) 8 | compile 'com.google.protobuf:protobuf-java:{@metadata.protoVersionBound.lower}' 9 | @join dependency : metadata.additionalDependencies 10 | compile '{@dependency.group}:{@dependency.name}:{@dependency.versionBound.lower}' 11 | @end 12 | @join dependency : metadata.protoPackageDependencies 13 | compile '{@dependency.group}:proto-{@dependency.name}:{@dependency.versionBound.lower}' 14 | @end 15 | @end 16 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/java/grpc/pom_base.xml.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | 5 | 4.0.0 6 | {@metadata.identifier} 7 | 0.0.0-SNAPSHOT 8 | {@metadata.identifier} 9 | {@description(metadata)} 10 | 11 | com.google.api.grpc 12 | google-api-grpc 13 | 0.0.0-SNAPSHOT 14 | 15 | 16 | {@dependencies(metadata)} 17 | 18 | 19 | @end 20 | 21 | @abstract dependencies(metadata) 22 | 23 | @abstract description(metadata) -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/java/grpc/pom_grpc.xml.snip: -------------------------------------------------------------------------------- 1 | @extends "metadatagen/java/grpc/pom_base.xml.snip" 2 | 3 | @override description(metadata) 4 | GRPC library for {@metadata.identifier} 5 | @end 6 | 7 | @override dependencies(metadata) 8 | 9 | io.grpc 10 | grpc-stub 11 | compile 12 | 13 | 14 | io.grpc 15 | grpc-protobuf 16 | compile 17 | 18 | 19 | com.google.api.grpc 20 | proto-{@metadata.packageName} 21 | compile 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/java/grpc/pom_protobuf.xml.snip: -------------------------------------------------------------------------------- 1 | @extends "metadatagen/java/grpc/pom_base.xml.snip" 2 | 3 | @override description(metadata) 4 | PROTO library for {@metadata.identifier} 5 | @end 6 | 7 | @override dependencies(metadata) 8 | 9 | com.google.protobuf 10 | protobuf-java 11 | compile 12 | 13 | @join dependency : metadata.additionalDependencies 14 | 15 | {@dependency.group} 16 | {@dependency.name} 17 | compile 18 | 19 | @end 20 | @join dependency : metadata.protoPackageDependencies 21 | 22 | {@dependency.group} 23 | proto-{@dependency.name} 24 | compile 25 | 26 | @end 27 | @end -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/py/MANIFEST.in.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(context) 2 | include README.rst LICENSE 3 | global-exclude *.py[co] 4 | global-exclude __pycache__ 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/py/PUBLISHING.rst.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(context) 2 | PUBLISHING 3 | ---------- 4 | 5 | Note: This folder has been generated by the gen-api-package tool. 6 | 7 | The instructions assumes that no changes have been made to the folder and its 8 | contents since it was created. 9 | 10 | PREREQUISITES 11 | ------------- 12 | 13 | - Python must be installed. 14 | 15 | 16 | TO PUBLISH 17 | ---------- 18 | 19 | - Make sure you have `an account`_ on pypi_. 20 | - Publish your package as described in `Packaging and Distributing Projects`_. 21 | 22 | E.g, 23 | 24 | $ python setup.py sdist register upload 25 | 26 | .. _`Packaging and Distributing projects`: https://packaging.python.org/en/latest/distributing.html#uploading-your-project-to-pypi 27 | .. _`an account`: https://pypi.python.org/pypi?%3Aaction=register_form 28 | .. _pypi: http://pypi.python.org 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/py/README.rst.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | gRPC library for {@metadata.fullName} 3 | 4 | {@metadata.protoPackageName} is the IDL-derived library for the {@metadata.shortName} ({@metadata.majorVersion}) service in the googleapis_ repository. 5 | 6 | .. _`googleapis`: https://github.com/googleapis/googleapis/tree/master/{@metadata.protoPath} 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/sample_manifest.snip: -------------------------------------------------------------------------------- 1 | # Template for sample manifest yaml file. 2 | 3 | @snippet generate(manifest) 4 | --- 5 | type: manifest/samples 6 | schema_version: {@manifest.schemaVersion} 7 | {@manifest.environment}: &{@manifest.environment} 8 | environment: "{@manifest.environment}" 9 | bin: "{@manifest.bin}" 10 | base_path: "{@manifest.basePath}" 11 | @if manifest.packageName 12 | package: "{@manifest.packageName}" 13 | @end 14 | invocation: "{@manifest.invocation}" 15 | samples: 16 | @join entry : manifest.sampleEntries 17 | - <<: *{@manifest.environment} 18 | sample: "{@entry.sample}" 19 | path: "{@entry.path}" 20 | @if entry.className 21 | class: "{@entry.className}" 22 | @end 23 | region_tag: "{@entry.regionTag}" 24 | @end 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/metadatagen/samplegen.snip: -------------------------------------------------------------------------------- 1 | @snippet commandlineArgumentList(args) 2 | @join arg : args on " " 3 | [--{@arg.cliFlagName} {@arg.cliFlagDefaultValue}] 4 | @end 5 | @end 6 | 7 | @snippet descriptionLines(commentDelimiter, descriptionLine, additionalDescriptionLines) 8 | {@commentDelimiter} description: {@descriptionLine} 9 | @if additionalDescriptionLines 10 | @join line : additionalDescriptionLines 11 | {@commentDelimiter} {@line} 12 | @end 13 | @end 14 | @end -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/nodejs/README.md.snip: -------------------------------------------------------------------------------- 1 | @extends "common.snip" 2 | 3 | @snippet generate(metadata) 4 | {@generateReadme(metadata.readmeMetadata)} 5 | @end 6 | 7 | @private generateReadme(metadata) 8 | @# {@metadata.targetLanguage} \ 9 | Client{@simplePlurality(metadata.hasMultipleServices)} for {@metadata.fullName} 10 | This is a generated README.md placeholder. Put your own documentation here. 11 | @end 12 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/nodejs/common.snip: -------------------------------------------------------------------------------- 1 | @extends "common.snip" 2 | 3 | @snippet comments(commentLines) 4 | @join comment : commentLines 5 | * {@comment} 6 | @end 7 | @end 8 | 9 | @snippet lineComments(commentLines) 10 | @join comment : commentLines 11 | // {@comment} 12 | @end 13 | @end 14 | 15 | @snippet importList(fileImports) 16 | @join import : fileImports 17 | @if import.moduleName 18 | const {@import.moduleName} = require('{@import.moduleName}'); 19 | @end 20 | @end 21 | @end 22 | 23 | @snippet if(c, t, f) 24 | @if c 25 | {@t} 26 | @else 27 | {@f} 28 | @end 29 | @end 30 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/nodejs/index.snip: -------------------------------------------------------------------------------- 1 | @extends "nodejs/common.snip" 2 | 3 | @snippet generate(index) 4 | {@lineComments(index.fileHeader.copyrightLines)} 5 | // 6 | {@lineComments(index.fileHeader.licenseLines)} 7 | 8 | 'use strict'; 9 | 10 | @join client : index.requireViews 11 | const {@client.clientName} = require('./{@client.fileName}'); 12 | @end 13 | 14 | @join client : index.requireViews 15 | module.exports.{@client.clientName} = {@client.clientName}; 16 | @end 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/nodejs/protos.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(protoList) 2 | [ 3 | @join stub : protoList.stubs on {@","}.add(BREAK) 4 | "{@protoPath(protoList)}/{@stub.protoFileName}" 5 | @end 6 | ] 7 | 8 | @end 9 | 10 | @private protoPath(protoList) 11 | @if protoList.fileHeader.hasVersion 12 | ../../protos 13 | @else 14 | ../protos 15 | @end 16 | @end 17 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/nodejs/sample_package.json.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | { 3 | "name": "{@metadata.identifier}", 4 | "private": true, 5 | "license": "{@metadata.licenseName}", 6 | "author": "{@metadata.author}", 7 | "files": [ 8 | "*.js" 9 | ], 10 | "dependencies": { 11 | @join packageDep : metadata.additionalDependencies on ",".add(BREAK) 12 | @if packageDep.versionBound.lower == packageDep.versionBound.upper 13 | "{@packageDep.name}": "{@packageDep.versionBound.lower}" 14 | @else 15 | "{@packageDep.name}": "^{@packageDep.versionBound.lower}" 16 | @end 17 | @end 18 | }, 19 | "engines": { 20 | "node": ">=8.10.0" 21 | } 22 | } 23 | @end 24 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/nodejs/version_browser.snip: -------------------------------------------------------------------------------- 1 | @extends "nodejs/common.snip" 2 | 3 | @snippet generate(index) 4 | {@lineComments(index.fileHeader.copyrightLines)} 5 | // 6 | {@lineComments(index.fileHeader.licenseLines)} 7 | 8 | 'use strict'; 9 | 10 | // Set a flag that we are running in a browser bundle. 11 | global.isBrowser = true; 12 | 13 | // Re-export all exports from ./index.js. 14 | module.exports = require('./index'); 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/nodejs/webpack.config.js.snip: -------------------------------------------------------------------------------- 1 | @extends "nodejs/common.snip" 2 | 3 | @snippet generate(index) 4 | {@lineComments(index.fileHeader.copyrightLines)} 5 | // 6 | {@lineComments(index.fileHeader.licenseLines)} 7 | 8 | module.exports = { 9 | entry: './src/browser.js', 10 | output: { 11 | library: "{@index.namespace}", 12 | filename: "./{@index.namespace}.js" 13 | }, 14 | node: { 15 | child_process: 'empty', 16 | fs: 'empty', 17 | crypto: 'empty', 18 | }, 19 | resolve: { 20 | extensions: ['.js', '.json'] 21 | }, 22 | module: { 23 | rules: [ 24 | { 25 | test: /node_modules[\\/]retry-request[\\/]/, 26 | use: 'null-loader' 27 | }, 28 | { 29 | test: /node_modules[\\/]https-proxy-agent[\\/]/, 30 | use: 'null-loader' 31 | }, 32 | { 33 | test: /node_modules[\\/]gtoken[\\/]/, 34 | use: 'null-loader' 35 | }, 36 | ] 37 | }, 38 | mode: 'production' 39 | }; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/packaging/api_defaults.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | # Provides default values used as metadata when constructing various packages. 17 | 18 | author: Google LLC 19 | email: googleapis-packages@google.com 20 | homepage: https://github.com/googleapis/googleapis 21 | license: Apache-2.0 22 | generated_package_version: 23 | python: 24 | lower: '0.1.0' 25 | upper: '0.2dev' 26 | nodejs: 27 | lower: '0.1.0' 28 | php: 29 | lower: '0.1.0' 30 | ruby: 31 | lower: '0.1.0' 32 | java: 33 | lower: '0.1.0' 34 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/php/composer.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | { 3 | "name": "{@metadata.identifier}", 4 | "description": "{@metadata.fullName} client for PHP", 5 | "license": "Apache-2.0", 6 | "minimum-stability": "stable", 7 | "autoload": { 8 | "psr-4": { 9 | "{@metadata.rootNamespace}\\": "src", 10 | "{@metadata.rootNamespace}\\Tests\\": "tests", 11 | "": "proto/src" 12 | } 13 | }, 14 | "require": { 15 | @join packageDep : metadata.dependencies 16 | "{@packageDep.name}": "^{@packageDep.versionBound.lower}", 17 | @end 18 | "php" : "^5.5 || ^7.0" 19 | }, 20 | "require-dev": { 21 | "phpunit/phpunit": "^4.8|^5.0" 22 | } 23 | } 24 | @end 25 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/php/partial_veneer_client.snip: -------------------------------------------------------------------------------- 1 | @extends "php/common.snip" 2 | 3 | @snippet generate(xapiClass) 4 | {@renderFileHeader(xapiClass.fileHeader, generatedCodeWarning(xapiClass))} 5 | 6 | /** 7 | * {@@inheritdoc} 8 | */ 9 | class {@xapiClass.name} extends {@xapiClass.parentName} 10 | { 11 | // This class is intentionally empty, and is intended to hold manual 12 | // additions to the generated {@@see {@xapiClass.parentName}} class. 13 | } 14 | @end 15 | 16 | @private generatedCodeWarning(xapiClass) 17 | /* 18 | * GENERATED CODE WARNING 19 | * This file was generated from the file 20 | * https://github.com/google/googleapis/blob/master/{@xapiClass.protoFilename} 21 | * and updates to that file get reflected here through a refresh process. 22 | * 23 | * @@experimental 24 | */ 25 | @end 26 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/php/smoke_test.snip: -------------------------------------------------------------------------------- 1 | @extends "php/common.snip" 2 | @extends "php/method_sample.snip" 3 | 4 | @snippet generate(smokeTest) 5 | {@renderFileHeader(smokeTest.fileHeader, simpleGeneratedCodeWarning())} 6 | 7 | /** 8 | * @@group {@smokeTest.apiName} 9 | * @@group gapic 10 | */ 11 | class {@smokeTest.name} extends GeneratedTest 12 | { 13 | /** 14 | * @@test 15 | */ 16 | public function {@smokeTest.methodName}() 17 | { 18 | @if smokeTest.requireProjectId 19 | $projectId = getenv('PROJECT_ID'); 20 | if ($projectId === false) { 21 | $this->fail('Environment variable PROJECT_ID must be set for smoke test'); 22 | } 23 | @end 24 | 25 | ${@smokeTest.apiMethod.apiVariableName} = new {@smokeTest.apiMethod.apiClassName}(); 26 | {@initCode(smokeTest.apiMethod.initCode, smokeTest.apiMethod.apiVariableName)} 27 | {@methodCallSampleCode(smokeTest.apiMethod)}; 28 | } 29 | } 30 | @end -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/MANIFEST.in.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(context) 2 | include README.rst LICENSE 3 | recursive-include google *.json *.proto 4 | recursive-include tests * 5 | global-exclude *.py[co] 6 | global-exclude __pycache__ 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/README.rst.snip: -------------------------------------------------------------------------------- 1 | @extends "readme_rst.snip" 2 | @extends "py/readme_common.snip" 3 | 4 | @snippet generate(metadata) 5 | {@generateReadme(metadata.readmeMetadata)} 6 | @end 7 | 8 | @private generateReadme(metadata) 9 | {@readme(metadata, exampleMethods(metadata.exampleMethods), installationLines(metadata))} 10 | @end 11 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/__init__.py.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(context) 2 | 3 | @end 4 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/docs/api.rst.snip: -------------------------------------------------------------------------------- 1 | @extends "common.snip" 2 | 3 | @snippet generate(metadata) 4 | {@title(metadata)} 5 | {@util.sectionHeaderLine(title(metadata))} 6 | 7 | @join module : metadata.clientModules 8 | {@clientModule(module)} 9 | @end 10 | @end 11 | 12 | @private title(metadata) 13 | Client{@simplePlurality(metadata.hasMultipleServices)} for {@metadata.fullName} 14 | @end 15 | 16 | @private clientModule(module) 17 | .. automodule:: {@module} 18 | :members: 19 | :inherited-members: 20 | @end 21 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/docs/index.rst.snip: -------------------------------------------------------------------------------- 1 | @extends "common.snip" 2 | @extends "readme_rst.snip" 3 | @extends "py/readme_common.snip" 4 | 5 | @snippet generate(metadata) 6 | {@generateIndex(metadata.readmeMetadata, metadata)} 7 | @end 8 | 9 | @private generateIndex(readmeMetadata, metadata) 10 | {@readme(readmeMetadata, exampleMethods(readmeMetadata.exampleMethods), installationLines(readmeMetadata))} 11 | 12 | {@apiReferences(metadata)} 13 | @end 14 | 15 | @private apiReferences(metadata) 16 | Api Reference 17 | ------------- 18 | .. toctree:: 19 | :maxdepth: 2 20 | 21 | @join module : metadata.apiModules 22 | {@module} 23 | @end 24 | @end 25 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/docs/types.rst.snip: -------------------------------------------------------------------------------- 1 | @extends "common.snip" 2 | 3 | @snippet generate(metadata) 4 | {@title(metadata)} 5 | {@util.sectionHeaderLine(title(metadata))} 6 | 7 | @join module : metadata.typeModules 8 | {@typeModule(module)} 9 | @end 10 | @end 11 | 12 | @private title(metadata) 13 | Types for {@metadata.fullName} Client{@simplePlurality(metadata.hasMultipleServices)} 14 | @end 15 | 16 | @private typeModule(module) 17 | .. automodule:: {@module} 18 | :members: 19 | @end 20 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/namespace__init__.py.snip: -------------------------------------------------------------------------------- 1 | @extends "py/common.snip" 2 | 3 | @snippet generate(context) 4 | {@licenseSection(context.fileHeader)} 5 | 6 | try: 7 | import pkg_resources 8 | pkg_resources.declare_namespace(__name__) 9 | except ImportError: 10 | import pkgutil 11 | __path__ = pkgutil.extend_path(__path__, __name__) 12 | {@""} 13 | @end 14 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/setup_cfg.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(context) 2 | [bdist_wheel] 3 | universal = 1 4 | 5 | @end -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/smoke_test.snip: -------------------------------------------------------------------------------- 1 | @extends "py/common.snip" 2 | @extends "py/method_sample.snip" 3 | 4 | @snippet generate(smokeTest) 5 | {@header(smokeTest.fileHeader)} 6 | 7 | {@testBody(smokeTest)} 8 | @end 9 | 10 | @private header(fileHeader) 11 | {@licenseSection(fileHeader)} 12 | {@renderImportSection(fileHeader.importSection)} 13 | @end 14 | 15 | @private testBody(smokeTest) 16 | class {@smokeTest.name}(object): 17 | 18 | def test_{@smokeTest.apiMethod.name}(self): 19 | @if smokeTest.requireProjectId 20 | project_id = os.environ['PROJECT_ID'] 21 | @end 22 | 23 | client = {@smokeTest.apiVariableName}.{@smokeTest.apiClassName}() 24 | {@initCode(smokeTest.apiMethod.initCode.lines)} 25 | @if smokeTest.apiMethod.hasReturnValue 26 | response = {@testMethodCall(smokeTest.apiMethod)} 27 | @else 28 | {@testMethodCall(smokeTest.apiMethod)} 29 | @end 30 | @end 31 | 32 | @private testMethodCall(apiMethod) 33 | client.{@apiMethod.name}(\ 34 | {@sampleMethodCallArgList(apiMethod.initCode)}) 35 | @end 36 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/py/top_level_entry_point.snip: -------------------------------------------------------------------------------- 1 | @extends "py/common.snip" 2 | 3 | @snippet generate(view) 4 | {@header(view.fileHeader)} 5 | 6 | {@body(view.packageHasEnums,view.requireViews)} 7 | {@""} 8 | @end 9 | 10 | @private header(fileHeader) 11 | {@licenseSection(fileHeader)} 12 | 13 | {@renderImportSection(fileHeader.importSection)} 14 | @end 15 | 16 | @private body(hasEnums, requireViews) 17 | {@exports(hasEnums,requireViews)} 18 | @end 19 | 20 | @private exports(hasEnums, requireViews) 21 | __all__ = ( 22 | @if hasEnums 23 | 'enums', 24 | @end 25 | 'types', 26 | @join view : requireViews on BREAK 27 | '{@view.clientName}', 28 | @end 29 | ) 30 | @end 31 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/CHANGELOG.md.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | @# Release History 3 | 4 | @end 5 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/Gemfile.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | source "https://rubygems.org" 3 | 4 | gemspec 5 | 6 | gem "gcloud-jsondoc", 7 | git: "https://github.com/GoogleCloudPlatform/google-cloud-ruby.git", 8 | branch: "gcloud-jsondoc" 9 | 10 | @# WORKAROUND: builds are having problems since the release of 3.0.0 11 | @# pin to the last known good version 12 | gem "public_suffix", "~> 2.0" 13 | gem "rake", "~> 11.0" 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/Gemfile_sample.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | source "https://rubygems.org" 3 | 4 | gem "{@metadata.gapicGemName}", path: "../../" 5 | @end 6 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/README.md.snip: -------------------------------------------------------------------------------- 1 | @extends "readme.snip" 2 | @extends "ruby/method_sample.snip" 3 | 4 | @snippet generate(metadata) 5 | {@generateReadme(metadata.readmeMetadata)} 6 | 7 | {@loggingText()} 8 | 9 | {@versionText()} 10 | 11 | @end 12 | 13 | @private generateReadme(metadata) 14 | {@readme(metadata, exampleMethods(metadata.exampleMethods), installationLines(metadata))} 15 | @end 16 | 17 | @private exampleMethods(methods) 18 | @join method : methods on BREAK 19 | @#### {@method.apiClassName} 20 | ```rb 21 | {@sampleCodeWithTopLevelImport(method)} 22 | ``` 23 | @end 24 | @end 25 | 26 | @private installationLines(metadata) 27 | $ gem install {@metadata.identifier} 28 | @end 29 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/gitignore.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | Gemfile.lock 3 | coverage/* 4 | doc/* 5 | pkg/* 6 | html/* 7 | jsondoc/* 8 | 9 | @# Ignore YARD stuffs 10 | .yardoc 11 | 12 | @# IDE settings 13 | .idea 14 | *.iml 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/rubocop.yml.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | AllCops: 3 | Exclude: 4 | - "{@metadata.identifier}.gemspec" 5 | # This should be removed in the future once GAPIC files conform more closely to rubocop checks. 6 | - "lib/google/**/*" 7 | - "Rakefile" 8 | - "test/**/*" 9 | - "acceptance/**/*" 10 | 11 | Documentation: 12 | Enabled: false 13 | 14 | Style/StringLiterals: 15 | EnforcedStyle: double_quotes 16 | Style/MethodDefParentheses: 17 | EnforcedStyle: require_no_parentheses 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/smoke_test.snip: -------------------------------------------------------------------------------- 1 | @extends "ruby/common.snip" 2 | @extends "ruby/method_sample.snip" 3 | 4 | @snippet generate(smokeTest) 5 | {@header(smokeTest.fileHeader)} 6 | 7 | {@testBody(smokeTest)} 8 | 9 | @end 10 | 11 | @private header(fileHeader) 12 | {@license(fileHeader)} 13 | 14 | @# AUTO GENERATED BY GAPIC 15 | 16 | {@importList(fileHeader.importSection.standardImports)} 17 | 18 | {@importList(fileHeader.importSection.appImports)} 19 | @end 20 | 21 | @private testBody(smokeTest) 22 | @switch smokeTest.apiMethod.apiVersion 23 | @case "Longrunning" 24 | describe "{@smokeTest.name}" do 25 | @default 26 | describe "{@smokeTest.name} {@smokeTest.apiVersion}" do 27 | @end 28 | 29 | it "runs one smoke test with {@smokeTest.apiMethod.name}" do 30 | @if smokeTest.requireProjectId 31 | unless ENV["{@smokeTest.projectIdVariableName}"] 32 | fail "{@smokeTest.projectIdVariableName} environment variable must be defined" 33 | end 34 | project_id = ENV["{@smokeTest.projectIdVariableName}"].freeze 35 | @end 36 | 37 | {@versionedClientSampleCode(smokeTest.apiMethod)} 38 | end 39 | end 40 | @end 41 | -------------------------------------------------------------------------------- /src/main/resources/com/google/api/codegen/ruby/yardopts.snip: -------------------------------------------------------------------------------- 1 | @snippet generate(metadata) 2 | --no-private 3 | --title={@metadata.fullName} 4 | --exclude _pb\.rb$ 5 | --markup markdown 6 | --markup-provider redcarpet 7 | 8 | ./lib/**/*.rb 9 | - 10 | README.md 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/config/PageStreamingConfigTest.java: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Google LLC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.google.api.codegen.config; 16 | 17 | import org.junit.Test; 18 | 19 | public class PageStreamingConfigTest { 20 | 21 | @Test 22 | public void testMissingPageStreamingParams() {} 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/config/testdata/missing_config_schema_version.yaml: -------------------------------------------------------------------------------- 1 | type: com.google.api.codegen.ConfigProto 2 | language_settings: 3 | go: 4 | package_name: cloud.google.com/go/myapi/apiv1 5 | interfaces: 6 | - name: google.example.myproto.v1.MyProto 7 | retry_codes_def: 8 | - name: idempotent 9 | retry_codes: 10 | - DEADLINE_EXCEEDED 11 | - name: non_idempotent 12 | retry_codes: 13 | retry_params_def: 14 | - name: default 15 | initial_retry_delay_millis: 100 16 | retry_delay_multiplier: 1.2 17 | max_retry_delay_millis: 1000 18 | initial_rpc_timeout_millis: 300 19 | rpc_timeout_multiplier: 1.3 20 | max_rpc_timeout_millis: 3000 21 | total_timeout_millis: 30000 22 | methods: 23 | - name: MyMethod 24 | flattening: 25 | groups: 26 | - parameters: 27 | - myfield 28 | required_fields: 29 | - myfield 30 | retry_codes_name: non_idempotent 31 | retry_params_name: default 32 | timeout_millis: 1000 33 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discogapic/testdata/simplecompute_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: simplecompute 2 | api_version: v1 3 | artifact_type: DISCOGAPIC 4 | organization_name: google-cloud 5 | proto_path: google/simplecompute 6 | release_level: BETA 7 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discovery/testdata/auth_3lo.json: -------------------------------------------------------------------------------- 1 | { 2 | "auth": { 3 | "oauth2": { 4 | "scopes": { 5 | "https://www.example.com/foo": {} 6 | } 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discovery/testdata/auth_adc.json: -------------------------------------------------------------------------------- 1 | { 2 | "auth": { 3 | "oauth2": { 4 | "scopes": { 5 | "https://www.googleapis.com/auth/cloud-platform": {} 6 | } 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discovery/testdata/auth_api_key.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discovery/testdata/basicinfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pubsub", 3 | "version": "v1", 4 | "title": "Google Cloud Pub/Sub API", 5 | "documentationLink": "https://cloud.google.com/pubsub/docs", 6 | "baseUrl": "https://pubsub.googleapis.com/", 7 | "rootUrl": "https://pubsub.googleapis.com/" 8 | } 9 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discovery/testdata/document.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "My API!", 3 | "methods": { 4 | "foo": { 5 | "description": "Insert a foo.", 6 | "id": "myapi.foo.insert" 7 | } 8 | }, 9 | "resources": { 10 | "bar": { 11 | "methods": { 12 | "baz": { 13 | "description": "Get a baz.", 14 | "id": "myapi.bar.baz.get", 15 | "parameterOrder": [ 16 | "p1" 17 | ], 18 | "parameters": { 19 | "p1": { 20 | "type": "boolean", 21 | "required": true, 22 | "location": "query" 23 | } 24 | }, 25 | "request": { 26 | "$ref": "GetBazRequest" 27 | }, 28 | "response": { 29 | "$ref": "Baz" 30 | }, 31 | "scopes": [ 32 | "https://www.example.com/baz" 33 | ] 34 | } 35 | } 36 | } 37 | }, 38 | "name": "myapi", 39 | "revision": "20170419", 40 | "rootUrl": "https://example.com", 41 | "schemas": { 42 | "GetBazRequest": { 43 | "type": "string" 44 | }, 45 | "Baz": { 46 | "type": "string" 47 | } 48 | }, 49 | "servicePath": "/api", 50 | "title": "My API!", 51 | "version": "v1", 52 | "version_module": "True" 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discovery/testdata/graph.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Represents a graph with the following directed edges: {Apple->items(Banana); items(Banana)->Banana; Banana->Cat; Cat->Banana; Cat->items(Dog); items(Dog)->Dog", 3 | "schemas": { 4 | "Apple": { 5 | "id": "Apple", 6 | "type": "object", 7 | "properties": { 8 | "items": { 9 | "additionalProperties": { 10 | "$ref": "Banana" 11 | } 12 | } 13 | } 14 | }, 15 | "Banana": { 16 | "id": "Banana", 17 | "type": "object", 18 | "properties": { 19 | "Cat": { 20 | "$ref": "Cat" 21 | } 22 | } 23 | }, 24 | "Cat": { 25 | "id": "Cat", 26 | "type": "array", 27 | "properties": { 28 | "Banana": { 29 | "$ref": "Banana" 30 | 31 | }, 32 | "items": { 33 | "additionalProperties": { 34 | "$ref": "Dog" 35 | } 36 | } 37 | } 38 | }, 39 | "Dog": { 40 | "id": "Dog", 41 | "type": "string" 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/discovery/testdata/method_.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Get a baz!", 3 | "httpMethod": "GET", 4 | "id": "foo.bar.baz.get", 5 | "parameterOrder": [ 6 | "p3", 7 | "p1" 8 | ], 9 | "parameters": { 10 | "p1": { 11 | "type": "string", 12 | "required": true, 13 | "location": "path" 14 | }, 15 | "p2": { 16 | "type": "string", 17 | "location": "query" 18 | }, 19 | "p3": { 20 | "type": "integer", 21 | "required": true 22 | } 23 | }, 24 | "request": { 25 | "$ref": "GetBazRequest" 26 | }, 27 | "response": { 28 | "$ref": "Baz" 29 | }, 30 | "scopes": [ 31 | "https://www.example.com/foo", 32 | "https://www.example.com/bar" 33 | ], 34 | "supportsMediaDownload": true, 35 | "supportsMediaUpload": true 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/metacode/testdata/myproto.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.myproto.v1; 6 | 7 | service MyProto { 8 | rpc MyMethod(MethodRequest) returns (MethodResponse); 9 | } 10 | 11 | message MethodRequest { 12 | repeated SubMessage mylist = 1; 13 | SubMessage myfield = 2; 14 | SubMessage secondfield = 3; 15 | 16 | map stringmap = 4; 17 | map intmap = 5; 18 | 19 | string formatted_field = 6; 20 | } 21 | 22 | message SubMessage { 23 | string subfield = 1; 24 | string subsecondfield = 2; 25 | } 26 | 27 | message MethodResponse { 28 | string myfield = 1; 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/metacode/testdata/myproto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: myproto-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.MyProto 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/packagegen/testdata/common_protos_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: common-protos 2 | artifact_type: PROTOBUF 3 | organization_name: google 4 | proto_path: google/example/library/v1 5 | proto_deps: [] 6 | release_level: ga 7 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/packagegen/testdata/fakeprotodir/test/nested/v1/test_pb2.py: -------------------------------------------------------------------------------- 1 | # Test text. 2 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/packagegen/testdata/library.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: library-example.googleapis.com 4 | title: Google Example Library API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.library.v1.LibraryService 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/packagegen/testdata/library_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: PROTOBUF 4 | organization_name: google-cloud 5 | proto_path: google/example/library/v1 6 | proto_deps: 7 | - google-common-protos 8 | - google-some-other-package-v1 9 | release_level: ga 10 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/packagegen/testdata/library_stubs_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: PROTOBUF 4 | organization_name: google-cloud 5 | proto_path: google/example/library/v1 6 | proto_deps: 7 | - google-common-protos 8 | - google-some-other-package-v1 9 | release_level: ga 10 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/another_service.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.library.v1; 6 | 7 | import "google/api/annotations.proto"; 8 | 9 | service MyProto { 10 | rpc MyMethod(MethodRequest) returns (MethodResponse) { 11 | option (google.api.http) = { post: "/v1/myMethod" body: "*" }; 12 | }; 13 | 14 | // Define a service with a reserved name 15 | rpc GetNamespace(MethodRequest) returns (Namespace) { 16 | option (google.api.http) = { post: "/v1/myMethod" body: "*" }; 17 | } 18 | } 19 | 20 | message MethodRequest { 21 | repeated SubMessage mylist = 1; 22 | SubMessage myfield = 2; 23 | SubMessage secondfield = 3; 24 | 25 | } 26 | 27 | message SubMessage { 28 | string subfield = 1; 29 | string subsecondfield = 2; 30 | } 31 | 32 | message MethodResponse { 33 | string myfield = 1; 34 | } 35 | 36 | // Define a message with a reserved name 37 | message Namespace { 38 | string value = 1; 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/book_from_anywhere.proto: -------------------------------------------------------------------------------- 1 | // Intended to test resource name generation for a message from a file without 2 | // any RPCs 3 | 4 | syntax = "proto3"; 5 | 6 | package google.example.library.v1; 7 | 8 | import "google/api/resource.proto"; 9 | 10 | option go_package = "google.golang.org/genproto/googleapis/example/library/v1;library"; 11 | option java_multiple_files = true; 12 | option java_outer_classname = "BookFromAnywhereProto"; 13 | option java_package = "com.google.example.library.v1"; 14 | 15 | // A single book in the archives or library. 16 | message BookFromAnywhere { 17 | // The resource name of the book. 18 | // Book names have the form `bookShelves/{shelf_id}/books/{book_id}` or 19 | // `archives/{archive_id}/books/{book_id}`. 20 | string name = 1 [ 21 | (google.api.resource_reference).type = "library.googleapis.com/Book"]; 22 | 23 | // The name of the book author. 24 | string author = 2; 25 | 26 | // The title of the book. 27 | string title = 3; 28 | 29 | // Value indicating whether the book has been read. 30 | bool read = 4; 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/different_submodule.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.cloud.example.v1.bar; 4 | 5 | message OtherType {} 6 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/errors.proto: -------------------------------------------------------------------------------- 1 | // Proto file describing the common error protos 2 | syntax = "proto3"; 3 | 4 | package google.example.library.v1; 5 | 6 | // Custom error class 7 | message CustomError { 8 | 9 | // An enum value that indicates which error occurred. 10 | int32 error_code = 1; 11 | 12 | // A human-readable description of the error. 13 | string message = 2; 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/field_mask.proto: -------------------------------------------------------------------------------- 1 | // Intended to test Python's import conflict resolution, since a file called 2 | // `field_mask.proto` already appears in the well-known types. 3 | 4 | syntax = "proto3"; 5 | 6 | package google.example.library.v1; 7 | 8 | option java_multiple_files = true; 9 | option java_outer_classname = "FieldMaskProto"; 10 | option java_package = "com.google.example.library.v1"; 11 | 12 | message FieldMask { 13 | 14 | enum Material { 15 | PAPIER_MACHE = 0; 16 | WOOD = 1; 17 | PORCELAIN = 2; 18 | SEQUINS = 3; 19 | CARDBOARD = 4; 20 | } 21 | 22 | repeated Material materials = 1; 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/library.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: library-example.googleapis.com:1234 4 | title: Google Example Library API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.library.v1.LibraryService 9 | mixins: 10 | - name: google.tagger.v1.Tagger 11 | - name: google.example.library.v1.MyProto 12 | 13 | # Additional types used 14 | types: 15 | - name: google.example.library.v1.CustomError 16 | 17 | # Documentation section 18 | documentation: 19 | summary: 20 | A simple Google Example Library API. 21 | 22 | # Auth section 23 | authentication: 24 | rules: 25 | - selector: '*' 26 | oauth: 27 | canonical_scopes: https://www.googleapis.com/auth/library, 28 | https://www.googleapis.com/auth/cloud-platform 29 | 30 | # Backend section 31 | backend: 32 | rules: 33 | - selector: google.example.library.v1.LibraryService.CreateShelf 34 | deadline: 1.0 35 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/library_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/library 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/longrunning.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: longrunning.googleapis.com 4 | title: Google Long Running Operations API 5 | 6 | apis: 7 | - name: google.longrunning.Operations 8 | 9 | # Documentation section 10 | documentation: 11 | overview: 12 | (== include google/longrunning/README.md ==) -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/longrunning_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: longrunning 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/longrunning 6 | proto_deps: 7 | - google-common-protos 8 | release_level: GA 9 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/multiple_services.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1.foo; 6 | 7 | import "different_submodule.proto"; 8 | import "google/api/annotations.proto"; 9 | import "google/protobuf/empty.proto"; 10 | import "other_shared_type.proto"; 11 | 12 | option java_multiple_files = true; 13 | option java_outer_classname = "ExampleProto"; 14 | option java_package = "com.google.example.v1"; 15 | 16 | service IncrementerService { 17 | // Increment. 18 | rpc Increment(IncrementRequest) returns (google.protobuf.Empty) { 19 | option (google.api.http) = { post: "/v1/me:increment" body: "*" }; 20 | } 21 | 22 | } 23 | 24 | service DecrementerService { 25 | // Decrement. 26 | rpc Decrement(stream DecrementRequest) returns (stream google.protobuf.Empty) { 27 | option (google.api.http) = { post: "/v1/me:decrement" body: "*" }; 28 | } 29 | } 30 | 31 | message IncrementRequest { 32 | } 33 | 34 | message DecrementRequest { 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/multiple_services.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: no-path-templates.googleapis.com 4 | title: Google Example API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.cloud.example.v1.foo.IncrementerService 9 | - name: google.cloud.example.v1.foo.DecrementerService 10 | - name: google.cloud.example.v2.foo.IncrementerService 11 | - name: google.cloud.example.v2.foo.DecrementerService 12 | 13 | # Documentation section 14 | documentation: 15 | summary: >- 16 | This description tests descriptions that span 17 | multiple lines. This is a service that increments 18 | and decrements a counter. 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/multiple_services_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: multiple_services 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/multiple_services 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/multiple_services_v2.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v2.foo; 6 | 7 | import "different_submodule.proto"; 8 | import "google/api/annotations.proto"; 9 | import "google/protobuf/empty.proto"; 10 | import "other_shared_type.proto"; 11 | 12 | option java_multiple_files = true; 13 | option java_outer_classname = "ExampleProto"; 14 | option java_package = "com.google.example.v2"; 15 | 16 | service IncrementerService { 17 | // Increment. 18 | rpc Increment(IncrementRequestV2) returns (google.protobuf.Empty) { 19 | option (google.api.http) = { post: "/v2/me:increment" body: "*" }; 20 | } 21 | 22 | } 23 | 24 | service DecrementerService { 25 | // Decrement. 26 | rpc Decrement(DecrementRequestV2) returns (google.protobuf.Empty) { 27 | option (google.api.http) = { post: "/v2/me:decrement" body: "*" }; 28 | } 29 | } 30 | 31 | message IncrementRequestV2 { 32 | } 33 | 34 | message DecrementRequestV2 { 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/my_streaming_proto.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.myproto.v1; 6 | 7 | service MyStreamingService { 8 | rpc MyMethod(stream StreamingRequest) returns (stream StreamingResponse); 9 | } 10 | 11 | message StreamingRequest { 12 | string myfield = 1; 13 | } 14 | 15 | message StreamingResponse { 16 | string myfield = 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/my_streaming_proto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: mystreaming-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.MyStreamingService 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/my_streaming_proto_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: my_streaming_service 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/example 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/myproto.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.myproto.v1; 6 | 7 | option php_namespace = "Google\\Example\\MyProto\\V1"; 8 | 9 | service MyProto { 10 | rpc MyMethod(MethodRequest) returns (MethodResponse); 11 | } 12 | 13 | message MethodRequest { 14 | repeated SubMessage mylist = 1; 15 | SubMessage myfield = 2; 16 | SubMessage secondfield = 3; 17 | 18 | } 19 | 20 | message SubMessage { 21 | string subfield = 1; 22 | string subsecondfield = 2; 23 | } 24 | 25 | message MethodResponse { 26 | string myfield = 1; 27 | } 28 | 29 | message TopLevelMessage { 30 | 31 | message AnotherSubMessage { 32 | string field = 1; 33 | } 34 | 35 | AnotherSubMessage subfield = 1; 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/myproto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: myproto-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.MyProto 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/no_path_templates.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1; 6 | 7 | import "google/api/annotations.proto"; 8 | import "google/protobuf/empty.proto"; 9 | import "no_path_templates_messages.proto"; 10 | 11 | option java_multiple_files = true; 12 | option java_outer_classname = "NoPathTemplatesProto"; 13 | option java_package = "com.google.example.noPathTemplates.v1"; 14 | 15 | service NoTemplatesAPIService { 16 | 17 | // Increments something. 18 | // Sometimes the comments are indented, but Sphinx doesn't like that. So 19 | // in Python we apply a pandoc transformation before the comments 20 | // get 21 | // to gapic-generator, and we don't need 22 | // to do anything here. 23 | rpc Increment(IncrementRequest) returns (google.protobuf.Empty) { 24 | option (google.api.http) = { post: "/v1/me:increment" body: "*" }; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/no_path_templates.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: no-path-templates.googleapis.com 4 | title: Google Fake API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.cloud.example.v1.NoTemplatesAPIService 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | Tests no path templates -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/no_path_templates_messages.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1; 6 | 7 | import "google/protobuf/empty.proto"; 8 | 9 | option java_multiple_files = true; 10 | option java_outer_classname = "NoPathTemplatesMessagesProto"; 11 | option java_package = "com.google.example.noPathTemplates.v1"; 12 | 13 | message IncrementRequest { 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/no_path_templates_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/library 6 | proto_deps: 7 | - google-common-protos 8 | - google-some-other-package-v1 9 | release_level: BETA 10 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/other_shared_type.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.test.shared.data; 4 | 5 | // This message is not used by the library service and should not be 6 | // included in the docs. 7 | message OtherType {} 8 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/common/shared_type.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.test.shared.data; 4 | 5 | import "other_shared_type.proto"; 6 | 7 | // This message is used by the library service and does not reference 8 | // other_shared_type.proto. 9 | message Used { 10 | int32 times_used = 1; 11 | } 12 | 13 | 14 | // This message is not used by the library service but does reference 15 | // other_shared_type.proto. 16 | message Unused { 17 | google.test.shared.data.OtherType other = 1; 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/another_service.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.library.v1; 6 | 7 | import "google/api/annotations.proto"; 8 | 9 | service MyProto { 10 | rpc MyMethod(MethodRequest) returns (MethodResponse) { 11 | option (google.api.http) = { post: "/v1/myMethod" body: "*" }; 12 | }; 13 | 14 | // Define a service with a reserved name 15 | rpc GetNamespace(MethodRequest) returns (Namespace) { 16 | option (google.api.http) = { post: "/v1/myMethod" body: "*" }; 17 | } 18 | } 19 | 20 | message MethodRequest { 21 | repeated SubMessage mylist = 1; 22 | SubMessage myfield = 2; 23 | SubMessage secondfield = 3; 24 | 25 | } 26 | 27 | message SubMessage { 28 | string subfield = 1; 29 | string subsecondfield = 2; 30 | } 31 | 32 | message MethodResponse { 33 | string myfield = 1; 34 | } 35 | 36 | // Define a message with a reserved name 37 | message Namespace { 38 | string value = 1; 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/book_from_anywhere.proto: -------------------------------------------------------------------------------- 1 | // Intended to test resource name generation for a message from a file without 2 | // any RPCs 3 | 4 | syntax = "proto3"; 5 | 6 | package google.example.library.v1; 7 | 8 | import "google/api/resource.proto"; 9 | 10 | option go_package = "google.golang.org/genproto/googleapis/example/library/v1;library"; 11 | option java_multiple_files = true; 12 | option java_outer_classname = "BookFromAnywhereProto"; 13 | option java_package = "com.google.example.library.v1"; 14 | 15 | // A single book in the archives or library. 16 | message BookFromAnywhere { 17 | // The resource name of the book. 18 | // Book names have the form `bookShelves/{shelf_id}/books/{book_id}` or 19 | // `archives/{archive_id}/books/{book_id}`. 20 | string name = 1 [ 21 | (google.api.resource_reference).type = "library.googleapis.com/Book"]; 22 | 23 | // The name of the book author. 24 | string author = 2; 25 | 26 | // The title of the book. 27 | string title = 3; 28 | 29 | // Value indicating whether the book has been read. 30 | bool read = 4; 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/different_submodule.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.cloud.example.v1.bar; 4 | 5 | message OtherType {} 6 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/errors.proto: -------------------------------------------------------------------------------- 1 | // Proto file describing the common error protos 2 | syntax = "proto3"; 3 | 4 | package google.example.library.v1; 5 | 6 | // Custom error class 7 | message CustomError { 8 | 9 | // An enum value that indicates which error occurred. 10 | int32 error_code = 1; 11 | 12 | // A human-readable description of the error. 13 | string message = 2; 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/field_mask.proto: -------------------------------------------------------------------------------- 1 | // Intended to test Python's import conflict resolution, since a file called 2 | // `field_mask.proto` already appears in the well-known types. 3 | 4 | syntax = "proto3"; 5 | 6 | package google.example.library.v1; 7 | 8 | option java_multiple_files = true; 9 | option java_outer_classname = "FieldMaskProto"; 10 | option java_package = "com.google.example.library.v1"; 11 | 12 | message FieldMask { 13 | 14 | enum Material { 15 | PAPIER_MACHE = 0; 16 | WOOD = 1; 17 | PORCELAIN = 2; 18 | SEQUINS = 3; 19 | CARDBOARD = 4; 20 | } 21 | 22 | repeated Material materials = 1; 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/library.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: library-example.googleapis.com:1234 4 | title: Google Example Library API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.library.v1.LibraryService 9 | mixins: 10 | - name: google.tagger.v1.Tagger 11 | - name: google.example.library.v1.MyProto 12 | 13 | # Additional types used 14 | types: 15 | - name: google.example.library.v1.CustomError 16 | 17 | # Documentation section 18 | documentation: 19 | summary: 20 | A simple Google Example Library API. 21 | 22 | # Auth section 23 | authentication: 24 | rules: 25 | - selector: '*' 26 | oauth: 27 | canonical_scopes: https://www.googleapis.com/auth/library, 28 | https://www.googleapis.com/auth/cloud-platform 29 | 30 | # Backend section 31 | backend: 32 | rules: 33 | - selector: google.example.library.v1.LibraryService.CreateShelf 34 | deadline: 1.0 35 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/library_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/library 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/longrunning.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: longrunning.googleapis.com 4 | title: Google Long Running Operations API 5 | 6 | apis: 7 | - name: google.longrunning.Operations 8 | 9 | # Documentation section 10 | documentation: 11 | overview: 12 | (== include google/longrunning/README.md ==) -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/longrunning_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: longrunning 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/longrunning 6 | proto_deps: 7 | - google-common-protos 8 | release_level: GA 9 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/multiple_services.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1.foo; 6 | 7 | import "different_submodule.proto"; 8 | import "google/api/annotations.proto"; 9 | import "google/protobuf/empty.proto"; 10 | import "other_shared_type.proto"; 11 | 12 | option java_multiple_files = true; 13 | option java_outer_classname = "ExampleProto"; 14 | option java_package = "com.google.example.v1"; 15 | 16 | service IncrementerService { 17 | // Increment. 18 | rpc Increment(IncrementRequest) returns (google.protobuf.Empty) { 19 | option (google.api.http) = { post: "/v1/me:increment" body: "*" }; 20 | } 21 | 22 | } 23 | 24 | service DecrementerService { 25 | // Decrement. 26 | rpc Decrement(stream DecrementRequest) returns (stream google.protobuf.Empty) { 27 | option (google.api.http) = { post: "/v1/me:decrement" body: "*" }; 28 | } 29 | } 30 | 31 | message IncrementRequest { 32 | } 33 | 34 | message DecrementRequest { 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/multiple_services.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: no-path-templates.googleapis.com 4 | title: Google Example API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.cloud.example.v1.foo.IncrementerService 9 | - name: google.cloud.example.v1.foo.DecrementerService 10 | - name: google.cloud.example.v2.foo.IncrementerService 11 | - name: google.cloud.example.v2.foo.DecrementerService 12 | 13 | # Documentation section 14 | documentation: 15 | summary: >- 16 | This description tests descriptions that span 17 | multiple lines. This is a service that increments 18 | and decrements a counter. 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/multiple_services_gapic.yaml: -------------------------------------------------------------------------------- 1 | type: com.google.api.codegen.ConfigProto 2 | config_schema_version: 1.0.0 3 | language_settings: 4 | java: 5 | package_name: com.google.gcloud.example 6 | python: 7 | package_name: google.cloud.example_v1.gapic.foo 8 | ruby: 9 | package_name: Google::Example::V1::Foo 10 | release_level: GA 11 | php: 12 | package_name: Google\Example\V1 13 | nodejs: 14 | package_name: multiple-services.v1 15 | domain_layer_location: google-cloud 16 | interfaces: 17 | - name: google.cloud.example.v1.foo.IncrementerService 18 | required_constructor_params: 19 | - service_address 20 | - scopes 21 | methods: 22 | - name: Increment 23 | retry_params_name: default 24 | timeout_millis: 10000 25 | - name: google.cloud.example.v1.foo.DecrementerService 26 | required_constructor_params: 27 | - service_address 28 | - scopes 29 | methods: 30 | - name: Decrement 31 | retry_params_name: default 32 | timeout_millis: 10000 33 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/multiple_services_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: multiple_services 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/multiple_services 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/my_streaming_proto.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.myproto.v1; 6 | 7 | service MyStreamingService { 8 | rpc MyMethod(stream StreamingRequest) returns (stream StreamingResponse); 9 | } 10 | 11 | message StreamingRequest { 12 | string myfield = 1; 13 | } 14 | 15 | message StreamingResponse { 16 | string myfield = 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/my_streaming_proto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: mystreaming-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.MyStreamingService 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/my_streaming_proto_gapic.yaml: -------------------------------------------------------------------------------- 1 | type: com.google.api.codegen.ConfigProto 2 | config_schema_version: 1.0.0 3 | language_settings: 4 | java: 5 | package_name: com.google.gcloud.example 6 | python: 7 | package_name: google.cloud.example_v1.gapic.foo 8 | ruby: 9 | package_name: Google::Example::V1::Foo 10 | release_level: GA 11 | php: 12 | package_name: Google\Example\V1 13 | nodejs: 14 | package_name: multiple-services.v1 15 | domain_layer_location: google-cloud 16 | interfaces: 17 | - name: google.example.myproto.v1.MyStreamingService 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/my_streaming_proto_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: my_streaming_service 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/example 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/myproto.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.myproto.v1; 6 | 7 | option php_namespace = "Google\\Example\\MyProto\\V1"; 8 | 9 | service MyProto { 10 | rpc MyMethod(MethodRequest) returns (MethodResponse); 11 | } 12 | 13 | message MethodRequest { 14 | repeated SubMessage mylist = 1; 15 | SubMessage myfield = 2; 16 | SubMessage secondfield = 3; 17 | 18 | } 19 | 20 | message SubMessage { 21 | string subfield = 1; 22 | string subsecondfield = 2; 23 | } 24 | 25 | message MethodResponse { 26 | string myfield = 1; 27 | } 28 | 29 | message TopLevelMessage { 30 | 31 | message AnotherSubMessage { 32 | string field = 1; 33 | } 34 | 35 | AnotherSubMessage subfield = 1; 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/myproto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: myproto-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.MyProto 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/no_path_templates.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1; 6 | 7 | import "google/api/annotations.proto"; 8 | import "google/protobuf/empty.proto"; 9 | import "no_path_templates_messages.proto"; 10 | 11 | option java_multiple_files = true; 12 | option java_outer_classname = "NoPathTemplatesProto"; 13 | option java_package = "com.google.example.noPathTemplates.v1"; 14 | 15 | service NoTemplatesAPIService { 16 | 17 | // Increments something. 18 | // Sometimes the comments are indented, but Sphinx doesn't like that. So 19 | // in Python we apply a pandoc transformation before the comments 20 | // get 21 | // to gapic-generator, and we don't need 22 | // to do anything here. 23 | rpc Increment(IncrementRequest) returns (google.protobuf.Empty) { 24 | option (google.api.http) = { post: "/v1/me:increment" body: "*" }; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/no_path_templates.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: no-path-templates.googleapis.com 4 | title: Google Fake API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.cloud.example.v1.NoTemplatesAPIService 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | Tests no path templates -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/no_path_templates_gapic.yaml: -------------------------------------------------------------------------------- 1 | type: com.google.api.codegen.ConfigProto 2 | config_schema_version: 1.0.0 3 | language_settings: 4 | java: 5 | package_name: com.google.gcloud.example 6 | python: 7 | package_name: example.gapic 8 | ruby: 9 | package_name: Google::Example::V1 10 | php: 11 | package_name: Google\Example\V1 12 | nodejs: 13 | # Intentionally skip the 'version' part to make sure it works 14 | # without it (like longrunning). 15 | package_name: example 16 | # Skip license_header to test default values. 17 | interfaces: 18 | - name: google.cloud.example.v1.NoTemplatesAPIService 19 | required_constructor_params: 20 | - service_address 21 | - scopes 22 | methods: 23 | - name: Increment 24 | retry_params_name: default 25 | timeout_millis: 10000 26 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/no_path_templates_messages.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1; 6 | 7 | import "google/protobuf/empty.proto"; 8 | 9 | option java_multiple_files = true; 10 | option java_outer_classname = "NoPathTemplatesMessagesProto"; 11 | option java_package = "com.google.example.noPathTemplates.v1"; 12 | 13 | message IncrementRequest { 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/no_path_templates_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/library 6 | proto_deps: 7 | - google-common-protos 8 | - google-some-other-package-v1 9 | release_level: BETA 10 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/other_shared_type.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.test.shared.data; 4 | 5 | // This message is not used by the library service and should not be 6 | // included in the docs. 7 | message OtherType {} 8 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/another_fake.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fake_field: "There is no type here." 3 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/babble_about_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: BabbleAboutBook 7 | title: "Test response handling for methods that return empty" 8 | description: "Test response handling for methods that return empty" 9 | region_tag: babble_about_book_1 10 | calling_patterns: [.*] 11 | response: 12 | - comment: "No one replied" 13 | - print: "No one replied." 14 | - service: google.example.library.v1.LibraryService 15 | rpc: BabbleAboutBook 16 | title: "Test default response handling is turned off for methods that return empty" 17 | description: "Test default response handling is turned off for methods that return empty" 18 | region_tag: babble_about_book_2 19 | calling_patterns: [.*] 20 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/create_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: CreateBook 7 | title: "testing maps" 8 | description: "testing maps in request fields" 9 | region_tag: testing_map 10 | request: 11 | - field: name%shelf 12 | value: "my_shelf" 13 | - field: book.map_string_value{1} 14 | value: "my_string_value" 15 | - field: book.map_message_value{"something"}.field 16 | value: 4147 17 | response: 18 | - print: ["Book created!"] 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/discuss_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: DiscussBook 7 | title: "Programming Books" 8 | description: "Testing calling forms" 9 | region_tag: turing 10 | request: 11 | - field: name 12 | value: BASIC 13 | - field: comment.comment 14 | value: comment_file 15 | value_is_file: true 16 | - field: image 17 | value: "image_file.jpg" 18 | value_is_file: true 19 | input_parameter: image_file_name 20 | - field: comment.stage 21 | value: DRAFT 22 | input_parameter: stage 23 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/fake.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: this.is.not.a.sample.config 3 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/find_related_books.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: FindRelatedBooks 7 | title: "The Odyssey" 8 | description: "Testing calling forms" 9 | region_tag: find_related_books_odyssey 10 | request: 11 | - field: names[0] 12 | value: Odyssey 13 | - field: shelves[0] 14 | value: Classics 15 | response: 16 | - define: book = $resp 17 | - print: 18 | - 'Here''s a related book: %s' 19 | - book 20 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/get_big_nothing.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: GetBigNothing 7 | title: "Test response handling for methods that return empty" 8 | description: "Test response handling for methods that return empty" 9 | region_tag: empty_response_type_with_response_handling 10 | response: 11 | - comment: "Got nothing" 12 | - print: "Got nothing." 13 | - service: google.example.library.v1.LibraryService 14 | rpc: GetBigNothing 15 | title: "Test default response handling is turned off for methods that return empty" 16 | description: "Test default response handling is turned off for methods that return empty" 17 | region_tag: empty_response_type_without_response_handling 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/get_book_from_absolutely_anywhere.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: GetBookFromAbsolutelyAnywhere 7 | region_tag: test_resource_name_oneof 8 | request: 9 | - field: name%archive 10 | value: "The archive to search for the book" 11 | - field: name%book 12 | value: "The ID of the book" 13 | response: 14 | - print: ["Archived book found."] 15 | - service: google.example.library.v1.LibraryService 16 | rpc: GetBookFromAbsolutelyAnywhere 17 | region_tag: test_resource_name_oneof_2 18 | request: 19 | - field: name%shelf 20 | value: "The Shelf to search for the book" 21 | - field: name%book 22 | value: "The ID of the book" 23 | response: 24 | - print: ["Book on shelf found."] 25 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/get_shelf.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: GetShelf 7 | region_tag: sample_get_shelf 8 | title: test_default_calling_form_unary 9 | description: "Test default calling forms for unary methods." 10 | request: 11 | - field: name%shelf 12 | value: "my-shelf" 13 | response: 14 | - print: 15 | - "The theme of the shelf is: %s" 16 | - $resp.theme 17 | - service: google.example.library.v1.LibraryService 18 | rpc: GetShelf 19 | region_tag: test_setting_up_empty_objects_in_request 20 | title: test_setting_up_empty_objects_in_request 21 | description: "Test setting up empty objects in the request objects." 22 | request: 23 | - field: name%shelf 24 | value: "my-shelf" 25 | - field: message 26 | value: "{}" 27 | comment: "we can set up this empty nested object now" 28 | - field: string_builder 29 | value: "{}" 30 | response: 31 | - print: ["Shelf found."] 32 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/list_shelves.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - id: test_default_calling_form_for_paging 6 | service: google.example.library.v1.LibraryService 7 | rpc: ListShelves 8 | region_tag: test_default_calling_form_for_paging 9 | title: "test default calling form for paging" 10 | description: "Test default calling form for paging methods." 11 | response: 12 | - print: 13 | - "shelf name: %s" 14 | - $resp 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/monolog_about_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: MonologAboutBook 7 | region_tag: sample_monolog_about_book 8 | title: "Programming Books" 9 | description: "Testing calling forms" 10 | calling_patterns: [".*"] 11 | request: 12 | - field: name 13 | value: BASIC 14 | response: 15 | - print: 16 | - "The stage of the comment is: %s" 17 | - $resp.stage 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/stream_books.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - region_tag: lovelace 6 | service: google.example.library.v1.LibraryService 7 | rpc: StreamBooks 8 | title: "Programming Books" 9 | description: "Testing calling forms" 10 | calling_patterns: request_streaming_server 11 | request: 12 | - field: name 13 | value: BASIC 14 | - region_tag: babbage 15 | service: google.example.library.v1.LibraryService 16 | rpc: StreamBooks 17 | title: "Programming Books" 18 | description: "Testing calling forms" 19 | calling_patterns: callable_streaming_server 20 | request: 21 | - field: name 22 | value: BASIC 23 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/samples/test_optional_required_flattening_params.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - region_tag: test_float_and_int64 6 | service: google.example.library.v1.LibraryService 7 | rpc: TestOptionalRequiredFlatteningParams 8 | calling_patterns: request 9 | request: 10 | - field: required_singular_float 11 | value: 1.2345 12 | input_parameter: param_float 13 | - field: required_singular_int64 14 | value: 67890 15 | input_parameter: param_long 16 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/gapicconfig/shared_type.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.test.shared.data; 4 | 5 | import "other_shared_type.proto"; 6 | 7 | // This message is used by the library service and does not reference 8 | // other_shared_type.proto. 9 | message Used { 10 | int32 times_used = 1; 11 | } 12 | 13 | 14 | // This message is not used by the library service but does reference 15 | // other_shared_type.proto. 16 | message Unused { 17 | google.test.shared.data.OtherType other = 1; 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/another_service.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.library.v1; 6 | 7 | import "google/api/annotations.proto"; 8 | 9 | service MyProto { 10 | rpc MyMethod(MethodRequest) returns (MethodResponse) { 11 | option (google.api.http) = { post: "/v1/myMethod" body: "*" }; 12 | }; 13 | 14 | // Define a service with a reserved name 15 | rpc GetNamespace(MethodRequest) returns (Namespace) { 16 | option (google.api.http) = { post: "/v1/myMethod" body: "*" }; 17 | } 18 | } 19 | 20 | message MethodRequest { 21 | repeated SubMessage mylist = 1; 22 | SubMessage myfield = 2; 23 | SubMessage secondfield = 3; 24 | 25 | } 26 | 27 | message SubMessage { 28 | string subfield = 1; 29 | string subsecondfield = 2; 30 | } 31 | 32 | message MethodResponse { 33 | string myfield = 1; 34 | } 35 | 36 | // Define a message with a reserved name 37 | message Namespace { 38 | string value = 1; 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/book_from_anywhere.proto: -------------------------------------------------------------------------------- 1 | // Intended to test resource name generation for a message from a file without 2 | // any RPCs 3 | 4 | syntax = "proto3"; 5 | 6 | package google.example.library.v1; 7 | 8 | import "google/api/resource.proto"; 9 | 10 | option go_package = "google.golang.org/genproto/googleapis/example/library/v1;library"; 11 | option java_multiple_files = true; 12 | option java_outer_classname = "BookFromAnywhereProto"; 13 | option java_package = "com.google.example.library.v1"; 14 | 15 | // A single book in the archives or library. 16 | message BookFromAnywhere { 17 | // The resource name of the book. 18 | // Book names have the form `bookShelves/{shelf_id}/books/{book_id}` or 19 | // `archives/{archive_id}/books/{book_id}`. 20 | string name = 1 [ 21 | (google.api.resource_reference).type = "library.googleapis.com/Book"]; 22 | 23 | // The name of the book author. 24 | string author = 2; 25 | 26 | // The title of the book. 27 | string title = 3; 28 | 29 | // Value indicating whether the book has been read. 30 | bool read = 4; 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/different_submodule.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.cloud.example.v1.bar; 4 | 5 | message OtherType {} 6 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/errors.proto: -------------------------------------------------------------------------------- 1 | // Proto file describing the common error protos 2 | syntax = "proto3"; 3 | 4 | package google.example.library.v1; 5 | 6 | // Custom error class 7 | message CustomError { 8 | 9 | // An enum value that indicates which error occurred. 10 | int32 error_code = 1; 11 | 12 | // A human-readable description of the error. 13 | string message = 2; 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/field_mask.proto: -------------------------------------------------------------------------------- 1 | // Intended to test Python's import conflict resolution, since a file called 2 | // `field_mask.proto` already appears in the well-known types. 3 | 4 | syntax = "proto3"; 5 | 6 | package google.example.library.v1; 7 | 8 | option java_multiple_files = true; 9 | option java_outer_classname = "FieldMaskProto"; 10 | option java_package = "com.google.example.library.v1"; 11 | 12 | message FieldMask { 13 | 14 | enum Material { 15 | PAPIER_MACHE = 0; 16 | WOOD = 1; 17 | PORCELAIN = 2; 18 | SEQUINS = 3; 19 | CARDBOARD = 4; 20 | } 21 | 22 | repeated Material materials = 1; 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/library.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: library-example.googleapis.com:1234 4 | title: Google Example Library API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.library.v1.LibraryService 9 | mixins: 10 | - name: google.tagger.v1.Tagger 11 | - name: google.example.library.v1.MyProto 12 | 13 | # Additional types used 14 | types: 15 | - name: google.example.library.v1.CustomError 16 | 17 | # Documentation section 18 | documentation: 19 | summary: 20 | A simple Google Example Library API. 21 | 22 | # Auth section 23 | authentication: 24 | rules: 25 | - selector: '*' 26 | oauth: 27 | canonical_scopes: https://www.googleapis.com/auth/library, 28 | https://www.googleapis.com/auth/cloud-platform 29 | 30 | # Backend section 31 | backend: 32 | rules: 33 | - selector: google.example.library.v1.LibraryService.CreateShelf 34 | deadline: 1.0 35 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/library_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/library 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/library_rest.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: library-example.googleapis.com:1234 4 | title: Google Example Library API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.library.v1.LibraryService 9 | mixins: 10 | - name: google.tagger.v1.Tagger 11 | - name: google.example.library.v1.MyProto 12 | 13 | # Additional types used 14 | types: 15 | - name: google.example.library.v1.CustomError 16 | 17 | # Documentation section 18 | documentation: 19 | summary: 20 | A simple Google Example Library API. 21 | 22 | # Auth section 23 | authentication: 24 | rules: 25 | - selector: '*' 26 | oauth: 27 | canonical_scopes: https://www.googleapis.com/auth/library, 28 | https://www.googleapis.com/auth/cloud-platform 29 | 30 | # Backend section 31 | backend: 32 | rules: 33 | - selector: google.example.library.v1.LibraryService.CreateShelf 34 | deadline: 1.0 35 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/library_rest_v2_gapic.yaml: -------------------------------------------------------------------------------- 1 | type: com.google.api.codegen.ConfigProto 2 | config_schema_version: 2.0.0 3 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/longrunning.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: longrunning.googleapis.com 4 | title: Google Long Running Operations API 5 | 6 | apis: 7 | - name: google.longrunning.Operations 8 | 9 | # Documentation section 10 | documentation: 11 | overview: 12 | (== include google/longrunning/README.md ==) -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/longrunning_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: longrunning 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/longrunning 6 | proto_deps: 7 | - google-common-protos 8 | release_level: GA 9 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/multiple_services.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1.foo; 6 | 7 | import "different_submodule.proto"; 8 | import "google/api/annotations.proto"; 9 | import "google/protobuf/empty.proto"; 10 | import "other_shared_type.proto"; 11 | 12 | option java_multiple_files = true; 13 | option java_outer_classname = "ExampleProto"; 14 | option java_package = "com.google.example.v1"; 15 | 16 | service IncrementerService { 17 | // Increment. 18 | rpc Increment(IncrementRequest) returns (google.protobuf.Empty) { 19 | option (google.api.http) = { post: "/v1/me:increment" body: "*" }; 20 | } 21 | 22 | } 23 | 24 | service DecrementerService { 25 | // Decrement. 26 | rpc Decrement(stream DecrementRequest) returns (stream google.protobuf.Empty) { 27 | option (google.api.http) = { post: "/v1/me:decrement" body: "*" }; 28 | } 29 | } 30 | 31 | message IncrementRequest { 32 | } 33 | 34 | message DecrementRequest { 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/multiple_services.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: no-path-templates.googleapis.com 4 | title: Google Example API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.cloud.example.v1.foo.IncrementerService 9 | - name: google.cloud.example.v1.foo.DecrementerService 10 | - name: google.cloud.example.v2.foo.IncrementerService 11 | - name: google.cloud.example.v2.foo.DecrementerService 12 | 13 | # Documentation section 14 | documentation: 15 | summary: >- 16 | This description tests descriptions that span 17 | multiple lines. This is a service that increments 18 | and decrements a counter. 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/multiple_services_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: multiple_services 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/multiple_services 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/multiple_services_v2.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v2.foo; 6 | 7 | import "different_submodule.proto"; 8 | import "google/api/annotations.proto"; 9 | import "google/protobuf/empty.proto"; 10 | import "other_shared_type.proto"; 11 | 12 | option java_multiple_files = true; 13 | option java_outer_classname = "ExampleProto"; 14 | option java_package = "com.google.example.v2"; 15 | 16 | service IncrementerService { 17 | // Increment. 18 | rpc Increment(IncrementRequestV2) returns (google.protobuf.Empty) { 19 | option (google.api.http) = { post: "/v2/me:increment" body: "*" }; 20 | } 21 | 22 | } 23 | 24 | service DecrementerService { 25 | // Decrement. 26 | rpc Decrement(DecrementRequestV2) returns (google.protobuf.Empty) { 27 | option (google.api.http) = { post: "/v2/me:decrement" body: "*" }; 28 | } 29 | } 30 | 31 | message IncrementRequestV2 { 32 | } 33 | 34 | message DecrementRequestV2 { 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/my_streaming_proto.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.myproto.v1; 6 | 7 | service MyStreamingService { 8 | rpc MyMethod(stream StreamingRequest) returns (stream StreamingResponse); 9 | } 10 | 11 | message StreamingRequest { 12 | string myfield = 1; 13 | } 14 | 15 | message StreamingResponse { 16 | string myfield = 1; 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/my_streaming_proto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: mystreaming-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.MyStreamingService 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/my_streaming_proto_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: my_streaming_service 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/example 6 | proto_deps: 7 | - name: google-common-protos 8 | - name: google-some-other-package-v1 9 | test_proto_deps: 10 | - name: google-some-test-package-v1 11 | release_level: GA 12 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/myproto.proto: -------------------------------------------------------------------------------- 1 | // (-- Library API for toolkit testing purposes --) 2 | 3 | syntax = "proto3"; 4 | 5 | package google.example.myproto.v1; 6 | 7 | option php_namespace = "Google\\Example\\MyProto\\V1"; 8 | 9 | service MyProto { 10 | rpc MyMethod(MethodRequest) returns (MethodResponse); 11 | } 12 | 13 | message MethodRequest { 14 | repeated SubMessage mylist = 1; 15 | SubMessage myfield = 2; 16 | SubMessage secondfield = 3; 17 | 18 | } 19 | 20 | message SubMessage { 21 | string subfield = 1; 22 | string subsecondfield = 2; 23 | } 24 | 25 | message MethodResponse { 26 | string myfield = 1; 27 | } 28 | 29 | message TopLevelMessage { 30 | 31 | message AnotherSubMessage { 32 | string field = 1; 33 | } 34 | 35 | AnotherSubMessage subfield = 1; 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/myproto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: myproto-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.MyProto 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/no_path_templates.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1; 6 | 7 | import "google/api/annotations.proto"; 8 | import "google/protobuf/empty.proto"; 9 | import "no_path_templates_messages.proto"; 10 | 11 | option java_multiple_files = true; 12 | option java_outer_classname = "NoPathTemplatesProto"; 13 | option java_package = "com.google.example.noPathTemplates.v1"; 14 | 15 | service NoTemplatesAPIService { 16 | 17 | // Increments something. 18 | // Sometimes the comments are indented, but Sphinx doesn't like that. So 19 | // in Python we apply a pandoc transformation before the comments 20 | // get 21 | // to gapic-generator, and we don't need 22 | // to do anything here. 23 | rpc Increment(IncrementRequest) returns (google.protobuf.Empty) { 24 | option (google.api.http) = { post: "/v1/me:increment" body: "*" }; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/no_path_templates.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: no-path-templates.googleapis.com 4 | title: Google Fake API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.cloud.example.v1.NoTemplatesAPIService 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | Tests no path templates -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/no_path_templates_messages.proto: -------------------------------------------------------------------------------- 1 | // Dummy service that doesn't use standard resource names 2 | 3 | syntax = "proto3"; 4 | 5 | package google.cloud.example.v1; 6 | 7 | import "google/protobuf/empty.proto"; 8 | 9 | option java_multiple_files = true; 10 | option java_outer_classname = "NoPathTemplatesMessagesProto"; 11 | option java_package = "com.google.example.noPathTemplates.v1"; 12 | 13 | message IncrementRequest { 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/no_path_templates_pkg2.yaml: -------------------------------------------------------------------------------- 1 | api_name: library 2 | api_version: v1 3 | artifact_type: GAPIC 4 | organization_name: google-cloud 5 | proto_path: google/library 6 | proto_deps: 7 | - google-common-protos 8 | - google-some-other-package-v1 9 | release_level: BETA 10 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/other_shared_type.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.test.shared.data; 4 | 5 | // This message is not used by the library service and should not be 6 | // included in the docs. 7 | message OtherType {} 8 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/another_fake.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fake_field: "There is no type here." 3 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/babble_about_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: BabbleAboutBook 7 | title: "Test response handling for methods that return empty" 8 | description: "Test response handling for methods that return empty" 9 | region_tag: babble_about_book_1 10 | calling_patterns: [.*] 11 | response: 12 | - comment: "No one replied" 13 | - print: "No one replied." 14 | - service: google.example.library.v1.LibraryService 15 | rpc: BabbleAboutBook 16 | title: "Test default response handling is turned off for methods that return empty" 17 | description: "Test default response handling is turned off for methods that return empty" 18 | region_tag: babble_about_book_2 19 | calling_patterns: [.*] 20 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/create_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: CreateBook 7 | title: "testing maps" 8 | description: "testing maps in request fields" 9 | region_tag: testing_map 10 | request: 11 | - field: name%shelf 12 | value: "my_shelf" 13 | - field: book.map_string_value{1} 14 | value: "my_string_value" 15 | - field: book.map_message_value{"something"}.field 16 | value: 4147 17 | response: 18 | - print: ["Book created!"] 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/discuss_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: DiscussBook 7 | title: "Programming Books" 8 | description: "Testing calling forms" 9 | region_tag: turing 10 | request: 11 | - field: name 12 | value: BASIC 13 | - field: comment.comment 14 | value: comment_file 15 | value_is_file: true 16 | - field: image 17 | value: "image_file.jpg" 18 | value_is_file: true 19 | input_parameter: image_file_name 20 | - field: comment.stage 21 | value: DRAFT 22 | input_parameter: stage 23 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/fake.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: this.is.not.a.sample.config 3 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/find_related_books.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: FindRelatedBooks 7 | title: "The Odyssey" 8 | description: "Testing calling forms" 9 | region_tag: find_related_books_odyssey 10 | request: 11 | - field: names[0] 12 | value: Odyssey 13 | - field: shelves[0] 14 | value: Classics 15 | response: 16 | - define: book = $resp 17 | - print: 18 | - 'Here''s a related book: %s' 19 | - book 20 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/get_big_nothing.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: GetBigNothing 7 | title: "Test response handling for methods that return empty" 8 | description: "Test response handling for methods that return empty" 9 | region_tag: empty_response_type_with_response_handling 10 | response: 11 | - comment: "Got nothing" 12 | - print: "Got nothing." 13 | - service: google.example.library.v1.LibraryService 14 | rpc: GetBigNothing 15 | title: "Test default response handling is turned off for methods that return empty" 16 | description: "Test default response handling is turned off for methods that return empty" 17 | region_tag: empty_response_type_without_response_handling 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/get_book_from_absolutely_anywhere.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: GetBookFromAbsolutelyAnywhere 7 | region_tag: test_resource_name_oneof 8 | request: 9 | - field: name%archive 10 | value: "The archive to search for the book" 11 | - field: name%book 12 | value: "The ID of the book" 13 | response: 14 | - print: ["Archived book found."] 15 | - service: google.example.library.v1.LibraryService 16 | rpc: GetBookFromAbsolutelyAnywhere 17 | region_tag: test_resource_name_oneof_2 18 | request: 19 | - field: name%shelf 20 | value: "The Shelf to search for the book" 21 | - field: name%book 22 | value: "The ID of the book" 23 | response: 24 | - print: ["Book on shelf found."] 25 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/get_shelf.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: GetShelf 7 | region_tag: sample_get_shelf 8 | title: test_default_calling_form_unary 9 | description: "Test default calling forms for unary methods." 10 | request: 11 | - field: name%shelf 12 | value: "my-shelf" 13 | response: 14 | - print: 15 | - "The theme of the shelf is: %s" 16 | - $resp.theme 17 | - service: google.example.library.v1.LibraryService 18 | rpc: GetShelf 19 | region_tag: test_setting_up_empty_objects_in_request 20 | title: test_setting_up_empty_objects_in_request 21 | description: "Test setting up empty objects in the request objects." 22 | request: 23 | - field: name%shelf 24 | value: "my-shelf" 25 | - field: message 26 | value: "{}" 27 | comment: "we can set up this empty nested object now" 28 | - field: string_builder 29 | value: "{}" 30 | response: 31 | - print: ["Shelf found."] 32 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/list_shelves.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - id: test_default_calling_form_for_paging 6 | service: google.example.library.v1.LibraryService 7 | rpc: ListShelves 8 | region_tag: test_default_calling_form_for_paging 9 | title: "test default calling form for paging" 10 | description: "Test default calling form for paging methods." 11 | response: 12 | - print: 13 | - "shelf name: %s" 14 | - $resp 15 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/monolog_about_book.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - service: google.example.library.v1.LibraryService 6 | rpc: MonologAboutBook 7 | region_tag: sample_monolog_about_book 8 | title: "Programming Books" 9 | description: "Testing calling forms" 10 | calling_patterns: [".*"] 11 | request: 12 | - field: name 13 | value: BASIC 14 | response: 15 | - print: 16 | - "The stage of the comment is: %s" 17 | - $resp.stage 18 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/stream_books.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - region_tag: lovelace 6 | service: google.example.library.v1.LibraryService 7 | rpc: StreamBooks 8 | title: "Programming Books" 9 | description: "Testing calling forms" 10 | calling_patterns: request_streaming_server 11 | request: 12 | - field: name 13 | value: BASIC 14 | - region_tag: babbage 15 | service: google.example.library.v1.LibraryService 16 | rpc: StreamBooks 17 | title: "Programming Books" 18 | description: "Testing calling forms" 19 | calling_patterns: callable_streaming_server 20 | request: 21 | - field: name 22 | value: BASIC 23 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/samples/test_optional_required_flattening_params.sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto 3 | schema_version: 1.2.0 4 | samples: 5 | - region_tag: test_float_and_int64 6 | service: google.example.library.v1.LibraryService 7 | rpc: TestOptionalRequiredFlatteningParams 8 | calling_patterns: request 9 | request: 10 | - field: required_singular_float 11 | value: 1.2345 12 | input_parameter: param_float 13 | - field: required_singular_int64 14 | value: 67890 15 | input_parameter: param_long 16 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/protoannotations/shared_type.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.test.shared.data; 4 | 5 | import "other_shared_type.proto"; 6 | 7 | // This message is used by the library service and does not reference 8 | // other_shared_type.proto. 9 | message Used { 10 | int32 times_used = 1; 11 | } 12 | 13 | 14 | // This message is not used by the library service but does reference 15 | // other_shared_type.proto. 16 | message Unused { 17 | google.test.shared.data.OtherType other = 1; 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/showcase/artman_showcase.yaml: -------------------------------------------------------------------------------- 1 | common: 2 | api_name: showcase 3 | api_version: v1beta1 4 | organization_name: google 5 | service_yaml: showcase.yaml 6 | gapic_yaml: v1beta1/showcase_gapic.yaml 7 | grpc_service_config: v1beta1/showcase_grpc_service_config.json 8 | proto_package: google.showcase.v1beta1 9 | src_proto_paths: 10 | - v1beta1 11 | proto_deps: 12 | - name: google-common-protos 13 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/showcase/showcase.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 3 3 | name: localhost:7469 4 | 5 | title: GAPIC Showcase API 6 | 7 | documentation: 8 | summary: 9 | GAPIC Showcase API. 10 | 11 | apis: 12 | - name: google.showcase.v1beta1.Echo 13 | - name: google.showcase.v1beta1.SequenceService 14 | 15 | authentication: 16 | rules: 17 | - selector: '*' 18 | oauth: 19 | canonical_scopes: https://www.googleapis.com/auth/cloud-platform -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/testsrc/showcase/showcase_gapic.yaml: -------------------------------------------------------------------------------- 1 | # FIXME: Address all the FIXMEs in this generated config before using it for 2 | # client generation. Remove this paragraph after you closed all the FIXMEs. The 3 | # retry_codes_name, required_fields, flattening, and timeout properties cannot 4 | # be precisely decided by the tooling and may require some configuration. 5 | type: com.google.api.codegen.ConfigProto 6 | config_schema_version: 2.0.0 7 | # The settings of generated code in a specific language. 8 | language_settings: 9 | java: 10 | package_name: com.google.showcase.v1beta1 11 | python: 12 | package_name: google.showcase_v1beta1.gapic 13 | go: 14 | package_name: cloud.google.com/go/showcase/apiv1beta1 15 | csharp: 16 | package_name: Google.Showcase.V1beta1 17 | ruby: 18 | package_name: Google::Showcase::V1beta1 19 | php: 20 | package_name: Google\Showcase\V1beta1 21 | nodejs: 22 | package_name: showcase.v1beta1 23 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/transformer/go/testdata/myproto.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: myproto-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.myproto.v1.Gopher 9 | - name: google.example.myproto.v1.Guru 10 | 11 | # Documentation section 12 | documentation: 13 | summary: 14 | A simple Google Example Library API. 15 | 16 | # Auth section 17 | authentication: 18 | rules: 19 | - selector: '*' 20 | oauth: 21 | canonical_scopes: https://www.googleapis.com/auth/library, 22 | https://www.googleapis.com/auth/cloud-platform 23 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/transformer/go/testdata/singleservice.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package google.example.odd.v1; 4 | 5 | service OddlyNamed {} 6 | 7 | message SpicyBanana {} 8 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/transformer/go/testdata/singleservice.yaml: -------------------------------------------------------------------------------- 1 | type: google.api.Service 2 | config_version: 1 3 | name: myproto-example.googleapis.com 4 | title: Google Example MyProto API 5 | 6 | # Included protobuf APIs 7 | apis: 8 | - name: google.example.odd.v1.OddlyNamed 9 | 10 | # Documentation section 11 | documentation: 12 | summary: 13 | A simple Google Example Library API. 14 | 15 | # Auth section 16 | authentication: 17 | rules: 18 | - selector: '*' 19 | oauth: 20 | canonical_scopes: https://www.googleapis.com/auth/library, 21 | https://www.googleapis.com/auth/cloud-platform 22 | -------------------------------------------------------------------------------- /src/test/java/com/google/api/codegen/transformer/go/testdata/singleservice_gapic.yaml: -------------------------------------------------------------------------------- 1 | type: com.google.api.codegen.ConfigProto 2 | language_settings: 3 | go: 4 | package_name: cloud.google.com/go/singleservice/apiv1 5 | interfaces: 6 | - name: google.example.odd.v1.OddlyNamed 7 | retry_codes_def: 8 | - name: idempotent 9 | retry_codes: 10 | - UNAVAILABLE 11 | - DEADLINE_EXCEEDED 12 | - name: non_idempotent 13 | retry_codes: 14 | retry_params_def: 15 | - name: default 16 | initial_retry_delay_millis: 100 17 | retry_delay_multiplier: 1.2 18 | max_retry_delay_millis: 1000 19 | initial_rpc_timeout_millis: 300 20 | rpc_timeout_multiplier: 1.3 21 | max_rpc_timeout_millis: 3000 22 | total_timeout_millis: 30000 23 | methods: 24 | -------------------------------------------------------------------------------- /testutils/check-baselines.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2018 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | # TODO: Do this as part of GapicGeneratorTest so this check can be run with Gradle check command. 20 | 21 | exit_status=0 22 | 23 | check() { 24 | if grep --include='*.baseline' -r -l -F $1 src/; then 25 | cat 1>&2 <