Codota Logo
Response.setExamples
Code IndexAdd Codota to your IDE (free)

How to use
setExamples
method
in
io.swagger.models.Response

Best Java code snippets using io.swagger.models.Response.setExamples (Showing top 5 results out of 315)

  • Common ways to obtain Response
private void myMethod () {
Response r =
  • Codota Iconnew Response()
  • Codota IconString description;new Response().description(description)
  • Codota IconOperation operation;Object key;operation.getResponses().get(key)
  • Smart code suggestions by Codota
}
origin: apache/servicecomb-java-chassis

private static void mergeResponse(Operation operation, ResponseConfig responseConfig) {
 if (operation.getResponses() == null) {
  operation.response(responseConfig.getCode(), responseConfig.getResponse());
  return;
 }
 Response response = operation.getResponses().get(String.valueOf(responseConfig.getCode()));
 if (response == null) {
  operation.response(responseConfig.getCode(), responseConfig.getResponse());
  return;
 }
 Response sourceResp = responseConfig.getResponse();
 if (StringUtils.isNotEmpty(sourceResp.getDescription()) && StringUtils.isEmpty(response.getDescription())) {
  response.setDescription(sourceResp.getDescription());
 }
 if (sourceResp.getSchema() != null && response.getSchema() == null) {
  response.setSchema(sourceResp.getSchema());
 }
 if (sourceResp.getExamples() != null && response.getExamples() == null) {
  response.setExamples(sourceResp.getExamples());
 }
 if (sourceResp.getHeaders() != null && response.getHeaders() == null) {
  response.setHeaders(sourceResp.getHeaders());
 }
 if (sourceResp.getVendorExtensions() != null && response.getVendorExtensions() == null) {
  response.setVendorExtensions(sourceResp.getVendorExtensions());
 }
}
origin: io.swagger/swagger-parser

if(examplesNode != null) {
  Map<String, Object> examples = Json.mapper().convertValue(examplesNode, Json.mapper().getTypeFactory().constructMapType(Map.class, String.class, Object.class));
  output.setExamples(examples);
origin: org.apache.servicecomb/swagger-generator-core

private static void mergeResponse(Operation operation, ResponseConfig responseConfig) {
 if (operation.getResponses() == null) {
  operation.response(responseConfig.getCode(), responseConfig.getResponse());
  return;
 }
 Response response = operation.getResponses().get(String.valueOf(responseConfig.getCode()));
 if (response == null) {
  operation.response(responseConfig.getCode(), responseConfig.getResponse());
  return;
 }
 Response sourceResp = responseConfig.getResponse();
 if (StringUtils.isNotEmpty(sourceResp.getDescription()) && StringUtils.isEmpty(response.getDescription())) {
  response.setDescription(sourceResp.getDescription());
 }
 if (sourceResp.getSchema() != null && response.getSchema() == null) {
  response.setSchema(sourceResp.getSchema());
 }
 if (sourceResp.getExamples() != null && response.getExamples() == null) {
  response.setExamples(sourceResp.getExamples());
 }
 if (sourceResp.getHeaders() != null && response.getHeaders() == null) {
  response.setHeaders(sourceResp.getHeaders());
 }
 if (sourceResp.getVendorExtensions() != null && response.getVendorExtensions() == null) {
  response.setVendorExtensions(sourceResp.getVendorExtensions());
 }
}
origin: io.swagger/swagger-jaxrs

private void addResponse(Operation operation, ApiResponse apiResponse, JsonView jsonView) {
  Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders(), jsonView);
  Map<String, Object> examples = parseExamples(apiResponse.examples());
  Response response = new Response()
      .description(apiResponse.message())
      .headers(responseHeaders);
  response.setExamples(examples);
  if (apiResponse.code() == 0) {
    operation.defaultResponse(response);
  } else {
    operation.response(apiResponse.code(), response);
  }
  if (StringUtils.isNotEmpty(apiResponse.reference())) {
    response.schema(new RefProperty(apiResponse.reference()));
  } else if (!isVoid(apiResponse.response())) {
    Type responseType = apiResponse.response();
    final Property property = ModelConverters.getInstance().readAsProperty(responseType, jsonView);
    if (property != null) {
      response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property));
      appendModels(responseType);
    }
  }
}
origin: javagossip/dorado

@SuppressWarnings("deprecation")
private void addResponse(Operation operation, ApiResponse apiResponse, JsonView jsonView) {
  Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders(), jsonView);
  Map<String, Object> examples = parseExamples(apiResponse.examples());
  Response response = new Response().description(apiResponse.message()).headers(responseHeaders);
  response.setExamples(examples);
  if (apiResponse.code() == 0) {
    operation.defaultResponse(response);
  } else {
    operation.response(apiResponse.code(), response);
  }
  if (StringUtils.isNotEmpty(apiResponse.reference())) {
    response.schema(new RefProperty(apiResponse.reference()));
  } else if (!isVoid(apiResponse.response())) {
    Type responseType = apiResponse.response();
    final Property property = ModelConverters.getInstance().readAsProperty(responseType, jsonView);
    if (property != null) {
      response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property));
      appendModels(responseType);
    }
  }
}
io.swagger.modelsResponsesetExamples

Popular methods of Response

  • <init>
  • getSchema
  • description
  • getHeaders
  • schema
  • getDescription
  • getResponseSchema
  • getExamples
  • headers
  • setDescription
  • setSchema
  • setResponseSchema
  • setSchema,
  • setResponseSchema,
  • getVendorExtensions,
  • setHeaders,
  • addHeader,
  • responseSchema,
  • setVendorExtension,
  • example,
  • setVendorExtensions

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getExternalFilesDir (Context)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now