com.google.protobuf.DescriptorProtos.ServiceOptions Java Examples

The following examples show how to use com.google.protobuf.DescriptorProtos.ServiceOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtoApiFromOpenApi.java    From api-compiler with Apache License 2.0 5 votes vote down vote up
public void addFromSwagger(Service.Builder serviceBuilder, Swagger swagger) {
  Map<String, String> duplicateOperationIdLookup = Maps.newHashMap();
  TreeSet<String> urlPaths = Sets.newTreeSet(swagger.getPaths().keySet());
  for (String urlPath : urlPaths) {
    Path pathObj = swagger.getPath(urlPath);
    createServiceMethodsFromPath(serviceBuilder, urlPath, pathObj, duplicateOperationIdLookup);
  }

  if (isAllowAllMethodsConfigured(swagger, diagCollector)) {
    Path userDefinedWildCardPathObject = new Path();
    if (urlPaths.contains(OpenApiUtils.WILDCARD_URL_PATH)) {
      userDefinedWildCardPathObject = swagger.getPath(OpenApiUtils.WILDCARD_URL_PATH);
    }
    createServiceMethodsFromPath(
        serviceBuilder,
        OpenApiUtils.WILDCARD_URL_PATH,
        getNewWildCardPathObject(userDefinedWildCardPathObject),
        duplicateOperationIdLookup);
  }

  coreApiBuilder.setVersion(swagger.getInfo().getVersion());
  if (isDeprecated(swagger)) {
    coreApiBuilder.addOptions(
        createBoolOption(
            ServiceOptions.getDescriptor()
                .findFieldByNumber(ServiceOptions.DEPRECATED_FIELD_NUMBER)
                .getFullName(),
            true));
  }
  serviceBuilder.addApis(coreApiBuilder);
}
 
Example #2
Source File: DescriptorGenerator.java    From api-compiler with Apache License 2.0 4 votes vote down vote up
private ServiceOptions generateServiceOptions(Api api) {
  ServiceOptions.Builder serviceOptionsBuilder = ServiceOptions.newBuilder();
  setOptions(serviceOptionsBuilder, api.getOptionsList(), SERVICE_OPTION_NAME_PREFIX);
  return serviceOptionsBuilder.build();
}
 
Example #3
Source File: Descriptors.java    From play-store-api with GNU General Public License v3.0 4 votes vote down vote up
/** Get the {@code ServiceOptions}, defined in {@code descriptor.proto}. */
public ServiceOptions getOptions() { return proto.getOptions(); }