Tabnine Logo
SwaggerCompatConverter
Code IndexAdd Tabnine to your IDE (free)

How to use
SwaggerCompatConverter
in
io.swagger.parser

Best Java code snippets using io.swagger.parser.SwaggerCompatConverter (Showing top 14 results out of 315)

origin: Sayi/swagger-diff

/**
 * @param oldSpec
 * @param newSpec
 * @param auths
 * @param version
 */
private SwaggerDiff(String oldSpec, String newSpec, List<AuthorizationValue> auths,
    String version) {
  if (SWAGGER_VERSION_V2.equals(version)) {
    SwaggerParser swaggerParser = new SwaggerParser();
    oldSpecSwagger = swaggerParser.read(oldSpec, auths, true);
    newSpecSwagger = swaggerParser.read(newSpec, auths, true);
  } else {
    SwaggerCompatConverter swaggerCompatConverter = new SwaggerCompatConverter();
    try {
      oldSpecSwagger = swaggerCompatConverter.read(oldSpec, auths);
      newSpecSwagger = swaggerCompatConverter.read(newSpec, auths);
    } catch (IOException e) {
      logger.error("cannot read api-doc from spec[version_v1.x]", e);
      return;
    }
  }
  if (null == oldSpecSwagger || null == newSpecSwagger) { throw new RuntimeException(
      "cannot read api-doc from spec."); }
}

origin: io.swagger/swagger-compat-spec-parser

public Property convertProperty(ModelProperty property) {
  Property output = null;
  output = propertyFromTypedObject(property);
  output.setDescription(property.getDescription());
  return output;
}
origin: SciGraph/SciGraph

apiList.add(output);
try {
 Swagger swagger = new SwaggerCompatConverter().convert(resourceListing, apiList);
 Map<String,Path> pathMap = swagger.getPaths();
origin: io.swagger/swagger-compat-spec-parser

SwaggerLegacyParser swaggerParser = new SwaggerLegacyParser();
ResourceListing resourceListing = null;
resourceListing = readResourceListing(input, migrationMessages, auths);
        if (!readAsSingleFile) {
          apiDeclaration = readDeclaration(input, migrationMessages, auths);
          readAsSingleFile = true; // avoid doing this again
          location = location.replaceAll("\\.\\{format\\}", ".json");
        apiDeclaration = readDeclaration(location, migrationMessages, auths);
  output = convert(resourceListing, apis);
origin: io.swagger/swagger-compat-spec-parser

public Swagger read(String input) throws IOException {
  return read(input, null);
}
origin: io.swagger/swagger-compat-spec-parser

  output.parameter(convertParameter(parameter));
Model responseProperty = modelFromExtendedTypedObject(operation);
Response response = new Response()
    .description("success")
origin: io.swagger/swagger-compat-spec-parser

  Operation operation = convertOperation(tag, op, apiDeclaration);
Model model = convertModel(apiModels.get(key));
definitions.put(key, model);
origin: io.swagger/swagger-compat-spec-parser

  bp.setSchema(modelFromExtendedTypedObject(param));
} else if (output instanceof SerializableParameter) {
  SerializableParameter sp = (SerializableParameter) output;
    p = arrayProperty;
  } else {
    p = propertyFromTypedObject(param);
    if (p == null) {
      LOGGER.warn(String.format(
origin: io.swagger/swagger-compat-spec-parser

public Model convertModel(io.swagger.models.apideclaration.Model model) {
  ModelImpl output = new ModelImpl();
  output.setName(model.getId());
  output.setDescription(model.getDescription());
  output.setDiscriminator(model.getDiscriminator());
  if (model.getRequired() != null) {
    output.setRequired(model.getRequired());
  }
  for (String key : model.getProperties().keySet()) {
    Property prop = convertProperty(model.getProperties().get(key));
    if (prop != null) {
      output.addProperty(key, prop);
    }
  }
  return output;
}
origin: io.swagger/swagger-compat-spec-parser

@Override
public SwaggerDeserializationResult readWithInfo(String location, List<AuthorizationValue> auths) {
  SwaggerDeserializationResult result = new SwaggerDeserializationResult();
  try {
    Swagger swagger = read(location, auths);
    if(swagger != null) {
      result.setSwagger(swagger);
      JsonNode jsonNode = Json.mapper().convertValue(swagger, JsonNode.class);
      return new Swagger20Parser().readWithInfo(jsonNode);
    }
  }
  catch (IOException e) {
    // TODO
  }
  return result;
}
origin: io.gravitee.management/gravitee-management-api-service

private Swagger transformV1(String content, Map<String, String> config) {
  // Create temporary file for Swagger parser (only for descriptor version < 2.x)
  File temp = null;
  Swagger swagger = null;
  try {
    temp = createTmpSwagger1File(content);
    swagger = new SwaggerCompatConverter().read(temp.getAbsolutePath());
    if (swagger != null && config != null && config.get("tryItURL") != null) {
      URI newURI = URI.create(config.get("tryItURL"));
      swagger.setSchemes(Collections.singletonList(Scheme.forValue(newURI.getScheme())));
      swagger.setHost((newURI.getPort() != -1) ? newURI.getHost() + ':' + newURI.getPort() : newURI.getHost());
      swagger.setBasePath((newURI.getRawPath().isEmpty()) ? "/" : newURI.getRawPath());
    }
  } catch (IOException ioe) {
    // Fallback to the new parser
  } finally {
    if (temp != null) {
      temp.delete();
    }
  }
  return swagger;
}
origin: gravitee-io/gravitee-management-rest-api

private Swagger transformV1(String content, Map<String, String> config) {
  // Create temporary file for Swagger parser (only for descriptor version < 2.x)
  File temp = null;
  Swagger swagger = null;
  try {
    temp = createTmpSwagger1File(content);
    swagger = new SwaggerCompatConverter().read(temp.getAbsolutePath());
    if (swagger != null && config != null && config.get("tryItURL") != null) {
      URI newURI = URI.create(config.get("tryItURL"));
      swagger.setSchemes(Collections.singletonList(Scheme.forValue(newURI.getScheme())));
      swagger.setHost((newURI.getPort() != -1) ? newURI.getHost() + ':' + newURI.getPort() : newURI.getHost());
      swagger.setBasePath((newURI.getRawPath().isEmpty()) ? "/" : newURI.getRawPath());
    }
  } catch (IOException ioe) {
    // Fallback to the new parser
  } finally {
    if (temp != null) {
      temp.delete();
    }
  }
  return swagger;
}
origin: io.gravitee.management/gravitee-management-api-service

private NewApiEntity prepareV1(ImportSwaggerDescriptorEntity swaggerDescriptor) {
  NewApiEntity apiEntity;
  try {
    logger.info("Loading an old Swagger descriptor from {}", swaggerDescriptor.getPayload());
    if (swaggerDescriptor.getType() == ImportSwaggerDescriptorEntity.Type.INLINE) {
      File temp = null;
      try {
        temp = createTmpSwagger1File(swaggerDescriptor.getPayload());
        apiEntity = mapSwagger12ToNewApi(new SwaggerCompatConverter().read(temp.getAbsolutePath()));
      } finally {
        if (temp != null) {
          temp.delete();
        }
      }
    } else {
      apiEntity = mapSwagger12ToNewApi(new SwaggerCompatConverter().read(swaggerDescriptor.getPayload()));
    }
  } catch (IOException ioe) {
    logger.error("Can not read old Swagger specification", ioe);
    throw new SwaggerDescriptorException();
  }
  return apiEntity;
}
origin: gravitee-io/gravitee-management-rest-api

private NewApiEntity prepareV1(ImportSwaggerDescriptorEntity swaggerDescriptor) {
  NewApiEntity apiEntity;
  try {
    logger.info("Loading an old Swagger descriptor from {}", swaggerDescriptor.getPayload());
    if (swaggerDescriptor.getType() == ImportSwaggerDescriptorEntity.Type.INLINE) {
      File temp = null;
      try {
        temp = createTmpSwagger1File(swaggerDescriptor.getPayload());
        apiEntity = mapSwagger12ToNewApi(new SwaggerCompatConverter().read(temp.getAbsolutePath()));
      } finally {
        if (temp != null) {
          temp.delete();
        }
      }
    } else {
      apiEntity = mapSwagger12ToNewApi(new SwaggerCompatConverter().read(swaggerDescriptor.getPayload()));
    }
  } catch (IOException ioe) {
    logger.error("Can not read old Swagger specification", ioe);
    throw new SwaggerDescriptorException();
  }
  return apiEntity;
}
io.swagger.parserSwaggerCompatConverter

Most used methods

  • <init>
  • read
  • convert
  • convertModel
  • convertOperation
  • convertParameter
  • convertProperty
  • modelFromExtendedTypedObject
  • propertyFromTypedObject
  • readDeclaration
  • readResourceListing
  • readResourceListing

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • compareTo (BigDecimal)
  • findViewById (Activity)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now