Search in sources :

Example 1 with ProtoParser

use of com.google.api.codegen.util.ProtoParser in project toolkit by googleapis.

the class GapicProductConfig method create.

/**
 * Creates an instance of GapicProductConfig based on ConfigProto, linking up API interface
 * configurations with specified interfaces in interfaceConfigMap. On errors, null will be
 * returned, and diagnostics are reported to the model.
 *
 * @param model The protobuf model for which we are creating a config.
 * @param configProto The parsed set of library config files from input
 * @param sampleConfigProto The parsed set of sample config files from the input
 * @param protoPackage The source proto package, as opposed to imported protos, that we will
 *     generate clients for.
 * @param clientPackage The desired package name for the generated client.
 * @param language The language that this config will be used to generate a client in.
 * @param grpcServiceConfig Method retries configuration.
 * @param transportProtocol Transport protocol to support.
 */
@Nullable
public static GapicProductConfig create(Model model, @Nullable ConfigProto configProto, @Nullable SampleConfigProto sampleConfigProto, @Nullable String protoPackage, @Nullable String clientPackage, TargetLanguage language, @Nullable ServiceConfig grpcServiceConfig, TransportProtocol transportProtocol) {
    final String defaultPackage;
    SymbolTable symbolTable = model.getSymbolTable();
    if (protoPackage != null) {
        // Default to using --package option for value of default package and first API protoFile.
        defaultPackage = protoPackage;
    } else if (configProto != null && configProto.getInterfacesCount() > 0) {
        // Otherwise use configProto to get the proto file containing the first interface listed in
        // the config proto, and use it as the assigned file for generated resource names, and to get
        // the default message namespace.
        ProtoFile file = symbolTable.lookupInterface(configProto.getInterfaces(0).getName()).getFile();
        defaultPackage = file.getProto().getPackage();
    } else {
        throw new NullPointerException("configProto and protoPackage cannot both be null. " + "If using artman, please add the proto_package field to artman config, " + "or switch to bazel.");
    }
    // Consider all proto files in the defaultPackage as well as its sub-packages
    // as source files.
    List<ProtoFile> sourceProtos = model.getFiles().stream().filter(f -> f.getProto().getPackage().startsWith(defaultPackage)).collect(Collectors.toList());
    if (protoPackage != null && configProto == null) {
        if (sourceProtos.isEmpty()) {
            model.getDiagReporter().getDiagCollector().addDiag(Diag.error(SimpleLocation.TOPLEVEL, "There are no source proto files with package %s", defaultPackage));
        }
        sourceProtos.forEach(model::addRoot);
    }
    // Toggle on/off proto annotations parsing.
    ProtoParser protoParser;
    ConfigVersionValidator versionValidator = new ConfigVersionValidator();
    if (versionValidator.isV2Config(configProto)) {
        versionValidator.validateV2Config(configProto);
        protoParser = new ProtoParser(true);
        if (configProto == null) {
            configProto = ConfigProto.getDefaultInstance();
        }
    } else {
        protoParser = new ProtoParser(false);
    }
    DiagCollector diagCollector = model.getDiagReporter().getDiagCollector();
    ProtoFile packageProtoFile = sourceProtos.isEmpty() ? null : sourceProtos.get(0);
    ImmutableMap<String, ResourceNameConfig> resourceNameConfigs;
    ResourceNameMessageConfigs messageConfigs;
    if (protoParser.isProtoAnnotationsEnabled()) {
        Map<String, ResourceDescriptorConfig> descriptorConfigMap = protoParser.getResourceDescriptorConfigMap(model.getFiles(), diagCollector);
        List<ResourceReference> fieldsWithResourceRefs = sourceProtos.stream().flatMap(protoFile -> protoFile.getMessages().stream()).flatMap(messageType -> messageType.getFields().stream()).filter(protoParser::hasResourceReference).map(protoParser::getResourceReference).collect(Collectors.toList());
        Set<String> configsWithChildTypeReferences = fieldsWithResourceRefs.stream().map(ResourceReference::getChildType).filter(t -> !Strings.isNullOrEmpty(t)).collect(Collectors.toSet());
        Set<String> configsWithTypeReferences = fieldsWithResourceRefs.stream().map(ResourceReference::getType).filter(t -> !Strings.isNullOrEmpty(t)).collect(Collectors.toSet());
        Map<String, DeprecatedCollectionConfigProto> deprecatedPatternResourceMap = configProto.getInterfacesList().stream().flatMap(i -> i.getDeprecatedCollectionsList().stream()).distinct().collect(ImmutableMap.toImmutableMap(DeprecatedCollectionConfigProto::getNamePattern, c -> c));
        // Create a pattern-to-resource map to make looking up parent resources easier.
        Map<String, List<ResourceDescriptorConfig>> patternResourceDescriptorMap = ResourceDescriptorConfig.getPatternResourceMap(descriptorConfigMap.values());
        // Create a child-to-parent map to make resolving child_type easier.
        Map<String, List<ResourceDescriptorConfig>> childParentResourceMap = ResourceDescriptorConfig.getChildParentResourceMap(descriptorConfigMap, patternResourceDescriptorMap);
        resourceNameConfigs = createResourceNameConfigsFromAnnotationsAndGapicConfig(model, diagCollector, configProto, packageProtoFile, language, descriptorConfigMap, configsWithTypeReferences, configsWithChildTypeReferences, deprecatedPatternResourceMap, patternResourceDescriptorMap, childParentResourceMap, defaultPackage);
        messageConfigs = ResourceNameMessageConfigs.createFromAnnotations(diagCollector, model.getFiles(), resourceNameConfigs, protoParser, descriptorConfigMap, childParentResourceMap);
    } else {
        resourceNameConfigs = createResourceNameConfigsFromGapicConfigOnly(model, diagCollector, configProto, packageProtoFile, language);
        messageConfigs = ResourceNameMessageConfigs.createFromGapicConfigOnly(sourceProtos, configProto, defaultPackage);
    }
    if (resourceNameConfigs == null) {
        return null;
    }
    String clientPackageName;
    LanguageSettingsProto settings = configProto.getLanguageSettingsMap().get(language.toString().toLowerCase());
    if (settings == null) {
        settings = LanguageSettingsProto.getDefaultInstance();
        if (!Strings.isNullOrEmpty(clientPackage)) {
            clientPackageName = clientPackage;
        } else {
            String basePackageName = Optional.ofNullable(protoPackage).orElse(getPackageName(model));
            clientPackageName = LanguageSettingsMerger.getFormattedPackageName(language, basePackageName);
        }
    } else {
        clientPackageName = settings.getPackageName();
    }
    ImmutableMap<String, Interface> protoInterfaces = getInterfacesFromProtoFile(diagCollector, sourceProtos, symbolTable);
    ImmutableList<GapicInterfaceInput> interfaceInputs;
    if (protoParser.isProtoAnnotationsEnabled()) {
        interfaceInputs = createInterfaceInputsWithAnnotationsAndGapicConfig(diagCollector, configProto.getInterfacesList(), protoInterfaces, language);
    } else {
        interfaceInputs = createInterfaceInputsWithGapicConfigOnly(diagCollector, configProto.getInterfacesList(), protoInterfaces, symbolTable, language);
    }
    if (interfaceInputs == null) {
        return null;
    }
    GrpcGapicRetryMapping grpcGapicRetryMapping = null;
    if (grpcServiceConfig != null) {
        grpcGapicRetryMapping = GrpcGapicRetryMapping.create(grpcServiceConfig, protoInterfaces);
    }
    ImmutableMap<String, InterfaceConfig> interfaceConfigMap = createInterfaceConfigMap(diagCollector, interfaceInputs, defaultPackage, settings, messageConfigs, resourceNameConfigs, language, transportProtocol, protoParser, grpcGapicRetryMapping);
    ImmutableList<String> copyrightLines;
    ImmutableList<String> licenseLines;
    String configSchemaVersion = null;
    LicenseHeaderUtil licenseHeaderUtil = new LicenseHeaderUtil();
    try {
        copyrightLines = licenseHeaderUtil.loadCopyrightLines();
        licenseLines = licenseHeaderUtil.loadLicenseLines();
    } catch (Exception e) {
        model.getDiagReporter().getDiagCollector().addDiag(Diag.error(SimpleLocation.TOPLEVEL, "Exception: %s", e.getMessage()));
        e.printStackTrace(System.err);
        throw new RuntimeException(e);
    }
    if (!configProto.equals(ConfigProto.getDefaultInstance())) {
        configSchemaVersion = configProto.getConfigSchemaVersion();
        if (Strings.isNullOrEmpty(configSchemaVersion)) {
            model.getDiagReporter().getDiagCollector().addDiag(Diag.error(SimpleLocation.TOPLEVEL, "config_schema_version field is required in GAPIC yaml."));
        }
    }
    Boolean enableStringFormatFunctionsOverride = null;
    if (configProto.hasEnableStringFormatFunctionsOverride()) {
        enableStringFormatFunctionsOverride = configProto.getEnableStringFormatFunctionsOverride().getValue();
    }
    if (interfaceConfigMap == null || copyrightLines == null || licenseLines == null) {
        return null;
    }
    return new AutoValue_GapicProductConfig(interfaceConfigMap, clientPackageName, settings.getDomainLayerLocation(), settings.getReleaseLevel(), messageConfigs, copyrightLines, licenseLines, resourceNameConfigs, protoParser, transportProtocol, createResponseFieldConfigMap(messageConfigs, resourceNameConfigs), configSchemaVersion, enableStringFormatFunctionsOverride, SampleConfig.createSampleConfigTable(sampleConfigProto, interfaceConfigMap), new Date());
}
Also used : DescriptorProtos(com.google.protobuf.DescriptorProtos) CollectionOneofProto(com.google.api.codegen.CollectionOneofProto) Iterables(com.google.common.collect.Iterables) java.util(java.util) MethodConfigProto(com.google.api.codegen.MethodConfigProto) CollectionConfigProto(com.google.api.codegen.CollectionConfigProto) ServiceConfig(com.google.api.codegen.grpc.ServiceConfig) SampleConfigProto(com.google.api.codegen.samplegen.v1p2.SampleConfigProto) Function(java.util.function.Function) StringUtils(org.apache.commons.lang3.StringUtils) Strings(com.google.common.base.Strings) ImmutableList(com.google.common.collect.ImmutableList) Api(com.google.protobuf.Api) TargetLanguage(com.google.api.codegen.common.TargetLanguage) ResourceNameTreatment(com.google.api.codegen.ResourceNameTreatment) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) Nullable(javax.annotation.Nullable) ConfigProto(com.google.api.codegen.ConfigProto) DeprecatedCollectionConfigProto(com.google.api.codegen.DeprecatedCollectionConfigProto) ReleaseLevel(com.google.api.codegen.ReleaseLevel) com.google.api.tools.framework.model(com.google.api.tools.framework.model) ResourceReference(com.google.api.ResourceReference) ImmutableMap(com.google.common.collect.ImmutableMap) InterfaceConfigProto(com.google.api.codegen.InterfaceConfigProto) LanguageSettingsMerger(com.google.api.codegen.configgen.mergers.LanguageSettingsMerger) Collectors(java.util.stream.Collectors) LanguageSettingsProto(com.google.api.codegen.LanguageSettingsProto) Name(com.google.api.codegen.util.Name) ConfigVersionValidator(com.google.api.codegen.util.ConfigVersionValidator) ImmutableTable(com.google.common.collect.ImmutableTable) AutoValue(com.google.auto.value.AutoValue) LicenseHeaderUtil(com.google.api.codegen.util.LicenseHeaderUtil) VisibilityProto(com.google.api.codegen.VisibilityProto) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ProtoParser(com.google.api.codegen.util.ProtoParser) ProtoParser(com.google.api.codegen.util.ProtoParser) LicenseHeaderUtil(com.google.api.codegen.util.LicenseHeaderUtil) com.google.api.tools.framework.model(com.google.api.tools.framework.model) ImmutableList(com.google.common.collect.ImmutableList) ResourceReference(com.google.api.ResourceReference) ConfigVersionValidator(com.google.api.codegen.util.ConfigVersionValidator) LanguageSettingsProto(com.google.api.codegen.LanguageSettingsProto) DeprecatedCollectionConfigProto(com.google.api.codegen.DeprecatedCollectionConfigProto) Nullable(javax.annotation.Nullable)

Example 2 with ProtoParser

use of com.google.api.codegen.util.ProtoParser in project toolkit by googleapis.

the class ResourceNameMessageConfigsTest method testCreateFlattenings.

@Test
public void testCreateFlattenings() {
    ProtoMethodModel methodModel = new ProtoMethodModel(createShelvesMethod);
    Field bookField = Mockito.mock(Field.class);
    Mockito.when(bookField.getType()).thenReturn(TypeRef.of(bookType));
    Mockito.when(bookField.getParent()).thenReturn(createShelvesRequest);
    Mockito.when(bookField.getSimpleName()).thenReturn("book");
    Mockito.when(bookType.getFields()).thenReturn(ImmutableList.of());
    Field nameField = Mockito.mock(Field.class);
    Mockito.when(nameField.getParent()).thenReturn(createShelvesRequest);
    Mockito.when(createShelvesRequest.getFullName()).thenReturn("library.CreateShelvesRequest");
    Mockito.when(nameField.getType()).thenReturn(TypeRef.fromPrimitiveName("string"));
    Mockito.when(nameField.getSimpleName()).thenReturn("name");
    Mockito.doReturn(ResourceReference.newBuilder().setType("library.googleapis.com/Shelf").build()).when(protoParser).getResourceReference(nameField);
    Mockito.doReturn(true).when(protoParser).hasResourceReference(nameField);
    Mockito.when(createShelvesRequest.lookupField("book")).thenReturn(bookField);
    Mockito.when(createShelvesRequest.lookupField("name")).thenReturn(nameField);
    Mockito.when(createShelvesRequest.getFields()).thenReturn(ImmutableList.of(bookField, nameField));
    Mockito.doReturn(ResourceReference.newBuilder().setType("library.googleapis.com/Shelf").build()).when(protoParser).getResourceReference(shelfName);
    Mockito.doReturn(true).when(protoParser).hasResourceReference(shelfName);
    Mockito.doReturn(ResourceReference.newBuilder().setType("library.googleapis.com/Book").build()).when(protoParser).getResourceReference(bookField);
    Mockito.doReturn(true).when(protoParser).hasResourceReference(bookField);
    Mockito.doReturn(ResourceReference.newBuilder().setType("library.googleapis.com/Shelf").build()).when(protoParser).getResourceReference(nameField);
    Mockito.doReturn(true).when(protoParser).hasResourceReference(nameField);
    // ProtoFile contributes flattenings {["name", "book"], ["name"]}.
    Mockito.doReturn(Arrays.asList(Arrays.asList("name", "book"), Arrays.asList("name"))).when(protoParser).getMethodSignatures(createShelvesMethod);
    Mockito.when(protoFile.getMessages()).thenReturn(ImmutableList.of(bookMessage, shelfMessage, createShelvesRequest));
    // Gapic config contributes flattenings {["book"]}.
    MethodConfigProto methodConfigProto = MethodConfigProto.newBuilder().setName(CREATE_SHELF_METHOD_NAME).setFlattening(FlatteningConfigProto.newBuilder().addGroups(FlatteningGroupProto.newBuilder().addAllParameters(Arrays.asList("book")))).setResourceNameTreatment(ResourceNameTreatment.STATIC_TYPES).build();
    DiagCollector diagCollector = new BoundedDiagCollector();
    assertThat(diagCollector.getErrorCount()).isEqualTo(0);
    ImmutableMap<String, ResourceNameConfig> resourceNameConfigs = GapicProductConfig.createResourceNameConfigsFromAnnotationsAndGapicConfig(null, diagCollector, ConfigProto.getDefaultInstance(), protoFile, TargetLanguage.CSHARP, resourceDescriptorConfigMap, resourceDescriptorConfigMap.keySet(), Collections.emptySet(), Collections.emptyMap(), patternResourceDescriptorMap, Collections.emptyMap(), "library");
    assertThat(diagCollector.getErrorCount()).isEqualTo(0);
    ResourceNameMessageConfigs messageConfigs = ResourceNameMessageConfigs.createFromAnnotations(diagCollector, sourceProtoFiles, resourceNameConfigs, protoParser, resourceDescriptorConfigMap, Collections.emptyMap());
    List<FlatteningConfig> flatteningConfigs = new ArrayList<>(FlatteningConfig.createFlatteningConfigs(diagCollector, messageConfigs, resourceNameConfigs, methodConfigProto, methodModel, protoParser));
    assertThat(diagCollector.getErrorCount()).isEqualTo(0);
    List<Diag> warningDiags = diagCollector.getDiags().stream().filter(d -> d.getKind().equals(Kind.WARNING)).collect(Collectors.toList());
    assertThat(flatteningConfigs).isNotNull();
    assertThat(flatteningConfigs.size()).isEqualTo(6);
    // Check the flattening from the Gapic config.
    List<FlatteningConfig> flatteningConfigFromGapicConfigs = flatteningConfigs.stream().filter(f -> f.getFlattenedFieldConfigs().size() == 1 && f.getFlattenedFieldConfigs().containsKey("book")).collect(ImmutableList.toImmutableList());
    assertThat(flatteningConfigFromGapicConfigs.size()).isEqualTo(2);
    for (FlatteningConfig configFromGapicConfig : flatteningConfigFromGapicConfigs) {
        Map<String, FieldConfig> paramsFromGapicConfigFlattening = configFromGapicConfig.getFlattenedFieldConfigs();
        assertThat(paramsFromGapicConfigFlattening.get("book").getField().getSimpleName()).isEqualTo("book");
        assertThat(((ProtoField) paramsFromGapicConfigFlattening.get("book").getField()).getType().getProtoType().getMessageType()).isEqualTo(bookType);
    }
    flatteningConfigs.removeAll(flatteningConfigFromGapicConfigs);
    // Check the flattenings from the protofile annotations.
    flatteningConfigs.sort(Comparator.comparingInt(c -> Iterables.size(c.getFlattenedFields())));
    FlatteningConfig shelfFlattening = flatteningConfigs.get(0);
    assertThat(Iterables.size(shelfFlattening.getFlattenedFields())).isEqualTo(1);
    FieldConfig nameConfig = shelfFlattening.getFlattenedFieldConfigs().get("name");
    assertThat(nameConfig.getResourceNameTreatment()).isEqualTo(ResourceNameTreatment.STATIC_TYPES);
    assertThat(((SingleResourceNameConfig) nameConfig.getResourceNameConfig()).getNamePattern()).isEqualTo(PROTO_SHELF_PATH);
    FlatteningConfig shelfAndBookFlattening = flatteningConfigs.get(2);
    assertThat(Iterables.size(shelfAndBookFlattening.getFlattenedFields())).isEqualTo(2);
    FieldConfig nameConfig2 = shelfAndBookFlattening.getFlattenedFieldConfigs().get("name");
    assertThat(nameConfig2.getResourceNameTreatment()).isEqualTo(ResourceNameTreatment.STATIC_TYPES);
    // Use PROTO_SHELF_PATH over GAPIC_SHELF_PATH.
    assertThat(((SingleResourceNameConfig) nameConfig2.getResourceNameConfig()).getNamePattern()).isEqualTo(PROTO_SHELF_PATH);
    FieldConfig bookConfig = shelfAndBookFlattening.getFlattenedFieldConfigs().get("book");
    assertThat(bookConfig.getResourceNameTreatment()).isEqualTo(ResourceNameTreatment.STATIC_TYPES);
    // Use the resource name path from proto file.
    assertThat(((SingleResourceNameConfig) bookConfig.getResourceNameConfig()).getNamePattern()).isEqualTo(PROTO_BOOK_PATH);
    assertThat(((ProtoTypeRef) bookConfig.getField().getType()).getProtoType().getMessageType()).isEqualTo(bookType);
    // Restore protoFile.getMessages()
    Mockito.when(protoFile.getMessages()).thenReturn(ImmutableList.of(bookMessage, shelfMessage));
}
Also used : TypeRef(com.google.api.tools.framework.model.TypeRef) CollectionOneofProto(com.google.api.codegen.CollectionOneofProto) Diag(com.google.api.tools.framework.model.Diag) Iterables(com.google.common.collect.Iterables) Arrays(java.util.Arrays) MethodConfigProto(com.google.api.codegen.MethodConfigProto) MessageType(com.google.api.tools.framework.model.MessageType) CollectionConfigProto(com.google.api.codegen.CollectionConfigProto) ProtoFile(com.google.api.tools.framework.model.ProtoFile) Field(com.google.api.tools.framework.model.Field) Method(com.google.api.tools.framework.model.Method) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) Spy(org.mockito.Spy) ResourceNameMessageConfigProto(com.google.api.codegen.ResourceNameMessageConfigProto) TargetLanguage(com.google.api.codegen.common.TargetLanguage) ResourceNameTreatment(com.google.api.codegen.ResourceNameTreatment) ConfigProto(com.google.api.codegen.ConfigProto) Kind(com.google.api.tools.framework.model.Diag.Kind) Before(org.junit.Before) ResourceDescriptor(com.google.api.ResourceDescriptor) ImmutableSet(com.google.common.collect.ImmutableSet) ResourceReference(com.google.api.ResourceReference) ImmutableMap(com.google.common.collect.ImmutableMap) InterfaceConfigProto(com.google.api.codegen.InterfaceConfigProto) FlatteningGroupProto(com.google.api.codegen.FlatteningGroupProto) Test(org.junit.Test) Truth.assertThat(com.google.common.truth.Truth.assertThat) Collectors(java.util.stream.Collectors) Name(com.google.api.codegen.util.Name) Mockito(org.mockito.Mockito) List(java.util.List) DiagCollector(com.google.api.tools.framework.model.DiagCollector) Interface(com.google.api.tools.framework.model.Interface) FileDescriptorProto(com.google.protobuf.DescriptorProtos.FileDescriptorProto) ProtoParser(com.google.api.codegen.util.ProtoParser) Comparator(java.util.Comparator) FlatteningConfigProto(com.google.api.codegen.FlatteningConfigProto) BoundedDiagCollector(com.google.api.tools.framework.model.BoundedDiagCollector) Collections(java.util.Collections) BoundedDiagCollector(com.google.api.tools.framework.model.BoundedDiagCollector) ArrayList(java.util.ArrayList) Diag(com.google.api.tools.framework.model.Diag) Field(com.google.api.tools.framework.model.Field) DiagCollector(com.google.api.tools.framework.model.DiagCollector) BoundedDiagCollector(com.google.api.tools.framework.model.BoundedDiagCollector) MethodConfigProto(com.google.api.codegen.MethodConfigProto) Test(org.junit.Test)

Example 3 with ProtoParser

use of com.google.api.codegen.util.ProtoParser in project toolkit by googleapis.

the class GapicProductConfig method create.

public static GapicProductConfig create(DiscoApiModel model, ConfigProto configProto, TargetLanguage language) {
    String defaultPackage = configProto.getLanguageSettingsMap().get(language.toString().toLowerCase()).getPackageName();
    ResourceNameMessageConfigs messageConfigs = ResourceNameMessageConfigs.createMessageResourceTypesConfig(model, configProto, defaultPackage);
    ImmutableMap<String, ResourceNameConfig> resourceNameConfigs = createResourceNameConfigs(model.getDiagCollector(), configProto, language);
    TransportProtocol transportProtocol = TransportProtocol.HTTP;
    LanguageSettingsProto settings = configProto.getLanguageSettingsMap().get(language.toString().toLowerCase());
    if (settings == null) {
        settings = LanguageSettingsProto.getDefaultInstance();
    }
    ImmutableMap<String, InterfaceConfig> interfaceConfigMap = createDiscoGapicInterfaceConfigMap(model, configProto, settings, messageConfigs, resourceNameConfigs, language);
    LicenseHeaderUtil licenseHeaderUtil = new LicenseHeaderUtil();
    ImmutableList<String> copyrightLines;
    ImmutableList<String> licenseLines;
    try {
        copyrightLines = licenseHeaderUtil.loadCopyrightLines();
        licenseLines = licenseHeaderUtil.loadLicenseLines();
    } catch (Exception e) {
        model.getDiagCollector().addDiag(Diag.error(SimpleLocation.TOPLEVEL, "Exception: %s", e.getMessage()));
        e.printStackTrace(System.err);
        throw new RuntimeException(e);
    }
    String configSchemaVersion = configProto.getConfigSchemaVersion();
    if (Strings.isNullOrEmpty(configSchemaVersion)) {
        model.getDiagCollector().addDiag(Diag.error(SimpleLocation.TOPLEVEL, "config_schema_version field is required in GAPIC yaml."));
    }
    Boolean enableStringFormatFunctionsOverride = null;
    if (configProto.getEnableStringFormatFunctionsOverride().isInitialized()) {
        enableStringFormatFunctionsOverride = configProto.getEnableStringFormatFunctionsOverride().getValue();
    }
    return new AutoValue_GapicProductConfig(interfaceConfigMap, settings.getPackageName(), settings.getDomainLayerLocation(), settings.getReleaseLevel(), messageConfigs, copyrightLines, licenseLines, resourceNameConfigs, new ProtoParser(false), transportProtocol, createResponseFieldConfigMap(messageConfigs, resourceNameConfigs), configSchemaVersion, enableStringFormatFunctionsOverride, ImmutableTable.of(), new Date());
}
Also used : ProtoParser(com.google.api.codegen.util.ProtoParser) LicenseHeaderUtil(com.google.api.codegen.util.LicenseHeaderUtil) LanguageSettingsProto(com.google.api.codegen.LanguageSettingsProto)

Aggregations

ProtoParser (com.google.api.codegen.util.ProtoParser)3 ResourceReference (com.google.api.ResourceReference)2 CollectionConfigProto (com.google.api.codegen.CollectionConfigProto)2 CollectionOneofProto (com.google.api.codegen.CollectionOneofProto)2 ConfigProto (com.google.api.codegen.ConfigProto)2 InterfaceConfigProto (com.google.api.codegen.InterfaceConfigProto)2 LanguageSettingsProto (com.google.api.codegen.LanguageSettingsProto)2 MethodConfigProto (com.google.api.codegen.MethodConfigProto)2 ResourceNameTreatment (com.google.api.codegen.ResourceNameTreatment)2 TargetLanguage (com.google.api.codegen.common.TargetLanguage)2 LicenseHeaderUtil (com.google.api.codegen.util.LicenseHeaderUtil)2 Name (com.google.api.codegen.util.Name)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Iterables (com.google.common.collect.Iterables)2 Collectors (java.util.stream.Collectors)2 ResourceDescriptor (com.google.api.ResourceDescriptor)1 DeprecatedCollectionConfigProto (com.google.api.codegen.DeprecatedCollectionConfigProto)1 FlatteningConfigProto (com.google.api.codegen.FlatteningConfigProto)1 FlatteningGroupProto (com.google.api.codegen.FlatteningGroupProto)1