io.swagger.models.Response Java Examples

The following examples show how to use io.swagger.models.Response. 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: OAS2Parser.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new operation object using the URI template object
 *
 * @param resource API resource data
 * @return a new operation object using the URI template object
 */
private Operation createOperation(SwaggerData.Resource resource) {
    Operation operation = new Operation();
    List<String> pathParams = getPathParamNames(resource.getPath());
    for (String pathParam : pathParams) {
        PathParameter pathParameter = new PathParameter();
        pathParameter.setName(pathParam);
        pathParameter.setType("string");
        operation.addParameter(pathParameter);
    }

    updateOperationManagedInfo(resource, operation);

    Response response = new Response();
    response.setDescription("OK");
    operation.addResponse(APIConstants.SWAGGER_RESPONSE_200, response);
    return operation;
}
 
Example #2
Source File: TestApiOperation.java    From servicecomb-java-chassis with Apache License 2.0 6 votes vote down vote up
private void testBase(Path path) {
  Assert.assertEquals(1, path.getOperations().size());

  Operation operation = path.getGet();

  Assert.assertEquals("summary", operation.getSummary());
  Assert.assertEquals("notes", operation.getDescription());
  Assert.assertEquals(Arrays.asList("tag1", "tag2"), operation.getTags());
  Assert.assertEquals(Arrays.asList("application/json"), operation.getProduces());
  Assert.assertEquals(Arrays.asList("application/json"), operation.getConsumes());
  Assert.assertEquals(Arrays.asList(Scheme.HTTP, Scheme.HTTPS), operation.getSchemes());

  Map<String, Response> responseMap = operation.getResponses();
  Assert.assertEquals(2, responseMap.size());

  Response response = responseMap.get(SwaggerConst.SUCCESS_KEY);
  Assert.assertNotNull(response);
  Assert.assertEquals(null, response.getResponseSchema());

  response = responseMap.get("202");
  Assert.assertNotNull(response);
  Assert.assertEquals(null, response.getResponseSchema());

  Assert.assertEquals(1, response.getHeaders().size());
  Assert.assertEquals("integer", response.getHeaders().get("h1").getType());
}
 
Example #3
Source File: PatchOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation patch = defaultOperation();
    final RefModel definition = new RefModel(getDefinitionId(node));
    patch.summary("patches " + getName(node));
    String description = node.getDescription() == null ? "patches " + getName(node) :
            node.getDescription();
    patch.description(description);
    patch.parameter(new BodyParameter()
            .name(getName(node) + ".body-param")
            .schema(definition)
            .description(getName(node) + " to be added or updated"));

    patch.response(200, new Response()
            .schema(new RefProperty(getDefinitionId(node)))
            .description(getName(node)));
    patch.response(204, new Response().description("Operation successful"));
    return patch;
}
 
Example #4
Source File: PutOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation put = defaultOperation();
    final RefModel definition = new RefModel(getDefinitionId(node));
    put.summary("creates or updates " + getName(node));
    String description = node.getDescription() == null ? "creates or updates " + getName(node) :
            node.getDescription();
    put.description(description);
    put.parameter(new BodyParameter()
            .name(getName(node) + ".body-param")
            .schema(definition)
            .description(getName(node) + " to be added or updated"));

    put.response(201, new Response().description("Object created"));
    put.response(204, new Response().description("Object modified"));
    return put;
}
 
Example #5
Source File: OASParserUtil.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a json string using the swagger object.
 *
 * @param swaggerObj swagger object
 * @return json string using the swagger object
 * @throws APIManagementException error while creating swagger json
 */
public static String getSwaggerJsonString(Swagger swaggerObj) throws APIManagementException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    mapper.enable(SerializationFeature.INDENT_OUTPUT);

    //this is to ignore "originalRef" in schema objects
    mapper.addMixIn(RefModel.class, IgnoreOriginalRefMixin.class);
    mapper.addMixIn(RefProperty.class, IgnoreOriginalRefMixin.class);
    mapper.addMixIn(RefPath.class, IgnoreOriginalRefMixin.class);
    mapper.addMixIn(RefParameter.class, IgnoreOriginalRefMixin.class);
    mapper.addMixIn(RefResponse.class, IgnoreOriginalRefMixin.class);

    //this is to ignore "responseSchema" in response schema objects
    mapper.addMixIn(Response.class, ResponseSchemaMixin.class);
    try {
        return new String(mapper.writeValueAsBytes(swaggerObj));
    } catch (JsonProcessingException e) {
        throw new APIManagementException("Error while generating Swagger json from model", e);
    }
}
 
Example #6
Source File: PlantUMLCodegen.java    From swagger2puml with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param operation
 * @return
 */
private String getErrorClassName(Operation operation) {
	StringBuilder errorClass = new StringBuilder();
	Map<String, Response> responses = operation.getResponses();
	for (Map.Entry<String, Response> responsesEntry : responses.entrySet()) {
		String responseCode = responsesEntry.getKey();

		if (responseCode.equalsIgnoreCase("default") || Integer.parseInt(responseCode) >= 300) {
			Property responseProperty = responsesEntry.getValue().getSchema();

			if (responseProperty instanceof RefProperty) {
				String errorClassName = ((RefProperty) responseProperty).getSimpleRef();
				if (!errorClass.toString().contains(errorClassName)) {
					if (StringUtils.isNotEmpty(errorClass)) {
						errorClass.append(",");
					}
					errorClass.append(errorClassName);
				}
			}
		}
	}

	return errorClass.toString();
}
 
Example #7
Source File: AnnotationUtils.java    From servicecomb-java-chassis with Apache License 2.0 6 votes vote down vote up
private static void generateResponse(Swagger swagger, ResponseConfig responseConfig) {
  Response response = new Response();

  Property property = generateResponseProperty(swagger, responseConfig);
  if (property != null) {
    Model model = new PropertyModelConverter().propertyToModel(property);
    response.setResponseSchema(model);
  }
  response.setDescription(responseConfig.getDescription());
  addExamplesToResponse(response, responseConfig);
  if (responseConfig.getResponseHeaders() != null) {
    Map<String, Property> headers = generateResponseHeader(swagger, responseConfig.getResponseHeaders());
    response.setHeaders(headers);
  }

  responseConfig.setResponse(response);
}
 
Example #8
Source File: VendorExtensionWithoutReader.java    From swagger-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void decorateOperation(final Operation operation, final Method method, final Iterator<SwaggerExtension> chain) {

    final TestVendorAnnotation annotation = method.getAnnotation(TestVendorAnnotation.class);
    if (annotation != null) {

        Map<String, Response> map = new HashMap<String, Response>(operation.getResponses());
        final Response value = new Response();
        value.setDescription(RESPONSE_DESCRIPTION);
        map.put(RESPONSE_STATUS_501, value);
        operation.setResponses(map);
    }

    if (chain.hasNext()) {
        chain.next().decorateOperation(operation, method, chain);
    }
}
 
Example #9
Source File: RestControllerProcessor.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the return value of a RequestMapping annotated method.
 *
 * @param returnType the return type.
 * @param operation the operation.
 * @param returnDescription the description of the return value.
 *
 * @throws MojoExecutionException if the return type isn't an XmlType.
 */
private void processRestMethodReturnValue(Class<?> returnType, Operation operation, String returnDescription) throws MojoExecutionException
{
    log.debug("Processing REST method return value \"" + returnType.getName() + "\".");

    // Add the class name to the list of classes which we will create an example for.
    exampleClassNames.add(returnType.getSimpleName());

    // Add the success response
    operation.response(200, new Response().description(returnDescription == null ? "Success" : returnDescription)
        .schema(new RefProperty(getXmlType(returnType).name().trim())));

    // If we have an error class, add that as the default response.
    if (modelErrorClass != null)
    {
        operation.defaultResponse(new Response().description("General Error").schema(new RefProperty(getXmlType(modelErrorClass).name().trim())));
    }
}
 
Example #10
Source File: Reader.java    From dorado with Apache License 2.0 6 votes vote down vote up
@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);
		}
	}
}
 
Example #11
Source File: PostOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation post = dropLastSegmentParameters ? listOperation() : defaultOperation();
    final RefModel definition = new RefModel(getDefinitionId(node));
    post.summary("creates " + getName(node));
    String description = node.getDescription() == null ? "creates " + getName(node) :
            node.getDescription();
    post.description(description);
    post.parameter(new BodyParameter()
            .name(getName(node) + ".body-param")
            .schema(definition)
            .description(getName(node) + " to be added to list"));

    post.response(201, new Response().description("Object created"));
    post.response(409, new Response().description("Object already exists"));
    return post;
}
 
Example #12
Source File: ApiGatewaySdkSwaggerApiImporter.java    From aws-apigateway-importer with Apache License 2.0 6 votes vote down vote up
private void createMethodResponses(RestApi api, Method method, String modelContentType, Map<String, Response> responses) {
    if (responses == null) {
        return;
    }

    // add responses from swagger
    responses.entrySet().forEach(e -> {
        if (e.getKey().equals("default")) {
            LOG.warn("Default response not supported, skipping");
        } else {
            LOG.info(format("Creating method response for api %s and method %s and status %s",
                            api.getId(), method.getHttpMethod(), e.getKey()));

            method.putMethodResponse(getCreateResponseInput(api, modelContentType, e.getValue()), e.getKey());
        }
    });
}
 
Example #13
Source File: DefaultCodegen.java    From TypeScript-Microservices with MIT License 6 votes vote down vote up
/**
 * Override with any special handling of response codes
 * @param responses Swagger Operation's responses
 * @return default method response or <tt>null</tt> if not found
 */
protected Response findMethodResponse(Map<String, Response> responses) {

    String code = null;
    for (String responseCode : responses.keySet()) {
        if (responseCode.startsWith("2") || responseCode.equals("default")) {
            if (code == null || code.compareTo(responseCode) > 0) {
                code = responseCode;
            }
        }
    }
    if (code == null) {
        return null;
    }
    return responses.get(code);
}
 
Example #14
Source File: ApiGatewaySdkSwaggerApiImporter.java    From aws-apigateway-importer with Apache License 2.0 6 votes vote down vote up
private Optional<Model> getModel(RestApi api, Response response) {

        String modelName;

        // if the response references a proper model, look for a model matching the model name
        if (response.getSchema() != null && response.getSchema().getType().equals("ref")) {
            modelName = ((RefProperty) response.getSchema()).getSimpleRef();
        } else {
            // if the response has an embedded schema, look for a model matching the generated name
            modelName = generateModelName(response);
        }

        try {
            Model model = api.getModelByName(modelName);
            if (model.getName() != null) {
                return Optional.of(model);
            }
        } catch (Exception ignored) {}

        return Optional.empty();
    }
 
Example #15
Source File: AbstractAdaCodegen.java    From TypeScript-Microservices with MIT License 6 votes vote down vote up
@Override
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
                                      Map<String, Model> definitions, Swagger swagger) {
    CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger);

    if (operation.getResponses() != null && !operation.getResponses().isEmpty()) {
        Response methodResponse = findMethodResponse(operation.getResponses());

        if (methodResponse != null) {
            if (methodResponse.getSchema() != null) {
                CodegenProperty cm = fromProperty("response", methodResponse.getSchema());
                op.vendorExtensions.put("x-codegen-response", cm);
                if(cm.datatype == "HttpContent") {
                    op.vendorExtensions.put("x-codegen-response-ishttpcontent", true);
                }
            }
        }
    }
    return op;
}
 
Example #16
Source File: PistacheServerCodegen.java    From TypeScript-Microservices with MIT License 6 votes vote down vote up
@Override
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
                                      Map<String, Model> definitions, Swagger swagger) {
    CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger);

    if (operation.getResponses() != null && !operation.getResponses().isEmpty()) {
        Response methodResponse = findMethodResponse(operation.getResponses());

        if (methodResponse != null) {
            if (methodResponse.getSchema() != null) {
                CodegenProperty cm = fromProperty("response", methodResponse.getSchema());
                op.vendorExtensions.put("x-codegen-response", cm);
                if(cm.datatype == "HttpContent") {
                    op.vendorExtensions.put("x-codegen-response-ishttpcontent", true);
                }
            }
        }
    }

    String pathForPistache = path.replaceAll("\\{(.*?)}", ":$1");
    op.vendorExtensions.put("x-codegen-pistache-path", pathForPistache);

    return op;
}
 
Example #17
Source File: CppRestClientCodegen.java    From TypeScript-Microservices with MIT License 6 votes vote down vote up
@Override
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
        Map<String, Model> definitions, Swagger swagger) {
    CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger);

    if (operation.getResponses() != null && !operation.getResponses().isEmpty()) {
        Response methodResponse = findMethodResponse(operation.getResponses());

        if (methodResponse != null) {
            if (methodResponse.getSchema() != null) {
                CodegenProperty cm = fromProperty("response", methodResponse.getSchema());
                op.vendorExtensions.put("x-codegen-response", cm);
                if(cm.datatype == "HttpContent")
                {
                    op.vendorExtensions.put("x-codegen-response-ishttpcontent", true);
                }
            }
        }
    }

    return op;
}
 
Example #18
Source File: TestVendorExtension.java    From swagger-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void decorateOperation(final Operation operation, final Method method, final Iterator<SwaggerExtension> chain) {

    final TestVendorAnnotation annotation = method.getAnnotation(TestVendorAnnotation.class);
    if (annotation != null) {

        Map<String, Response> map = new HashMap<String, Response>(operation.getResponses());
        final Response value = new Response();
        value.setDescription(RESPONSE_DESCRIPTION);
        map.put(RESPONSE_STATUS_401, value);
        operation.setResponses(map);
    }

    if (chain.hasNext()) {
        chain.next().decorateOperation(operation, method, chain);
    }
}
 
Example #19
Source File: ExtendedSwaggerReader.java    From msf4j with Apache License 2.0 6 votes vote down vote up
private void addResponse(Operation operation, ApiResponse apiResponse) {
    Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders());

    Response response = new Response().description(apiResponse.message()).headers(responseHeaders);

    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);
        if (property != null) {
            response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property));
            appendModels(responseType);
        }
    }
}
 
Example #20
Source File: ConsumerDrivenValidator.java    From assertj-swagger with Apache License 2.0 6 votes vote down vote up
private void validateResponses(Map<String, Response> actualOperationResponses, Map<String, Response> expectedOperationResponses, String httpMethod, String path) {
    String message = String.format("Checking responses of '%s' operation of path '%s'", httpMethod, path);
    if (MapUtils.isNotEmpty(expectedOperationResponses)) {
        softAssertions.assertThat(actualOperationResponses).as(message).isNotEmpty();
        if (MapUtils.isNotEmpty(actualOperationResponses)) {
            softAssertions.assertThat(actualOperationResponses.keySet()).as(message).hasSameElementsAs(expectedOperationResponses.keySet());
            for (Map.Entry<String, Response> actualResponseEntry : actualOperationResponses.entrySet()) {
                Response expectedResponse = expectedOperationResponses.get(actualResponseEntry.getKey());
                Response actualResponse = actualResponseEntry.getValue();
                String responseName = actualResponseEntry.getKey();
                validateResponse(actualResponse, expectedResponse, responseName, httpMethod, path);
            }
        }
    } else {
        softAssertions.assertThat(actualOperationResponses).as(message).isNullOrEmpty();
    }
}
 
Example #21
Source File: DocumentationDrivenValidator.java    From assertj-swagger with Apache License 2.0 6 votes vote down vote up
private void validateResponses(Map<String, Response> actualOperationResponses, Map<String, Response> expectedOperationResponses, String httpMethod, String path) {
    String message = String.format("Checking responses of '%s' operation of path '%s'", httpMethod, path);
    if (MapUtils.isNotEmpty(expectedOperationResponses)) {
        softAssertions.assertThat(actualOperationResponses).as(message).isNotEmpty();
        if (MapUtils.isNotEmpty(actualOperationResponses)) {
            validateResponseByConfig(actualOperationResponses, expectedOperationResponses, message);
            for (Map.Entry<String, Response> actualResponseEntry : actualOperationResponses.entrySet()) {
                Response expectedResponse = expectedOperationResponses.get(actualResponseEntry.getKey());
                Response actualResponse = actualResponseEntry.getValue();
                String responseName = actualResponseEntry.getKey();
                validateResponse(actualResponse, expectedResponse, responseName, httpMethod, path);
            }
        }
    } else {
        softAssertions.assertThat(actualOperationResponses).as(message).isNullOrEmpty();
    }
}
 
Example #22
Source File: SwaggerToProtoGenerator.java    From servicecomb-java-chassis with Apache License 2.0 6 votes vote down vote up
private void fillResponseType(Operation operation, ProtoMethod protoMethod) {
  for (Entry<String, Response> entry : operation.getResponses().entrySet()) {
    String type = convertSwaggerType(entry.getValue().getResponseSchema());
    boolean wrapped = !messages.contains(type);

    ProtoResponse protoResponse = new ProtoResponse();
    protoResponse.setTypeName(type);

    if (wrapped) {
      String wrapName = StringUtils.capitalize(operation.getOperationId()) + "ResponseWrap" + entry.getKey();
      wrapPropertyToMessage(wrapName, entry.getValue().getResponseSchema());

      protoResponse.setTypeName(wrapName);
    }
    protoMethod.addResponse(entry.getKey(), protoResponse);
  }
}
 
Example #23
Source File: SwaggerInventory.java    From swagger-parser with Apache License 2.0 6 votes vote down vote up
public void process(Operation operation) {
    this.operations.add(operation);
    Iterator var2;
    if(operation.getParameters() != null) {
        var2 = operation.getParameters().iterator();

        while(var2.hasNext()) {
            Parameter key = (Parameter)var2.next();
            this.process(key);
        }
    }

    if(operation.getResponses() != null) {
        var2 = operation.getResponses().keySet().iterator();

        while(var2.hasNext()) {
            String key1 = (String)var2.next();
            Response response = (Response)operation.getResponses().get(key1);
            this.process(response);
        }
    }

}
 
Example #24
Source File: TestSwaggerUtils.java    From servicecomb-java-chassis with Apache License 2.0 6 votes vote down vote up
@Test
public void correctResponsesHavePaths() {
  Response response = new Response();

  Operation operation = new Operation();
  operation.addResponse("200", response);

  Path path = new Path();
  path.set("get", operation);

  Swagger swagger = new Swagger();
  swagger.path("/base", path);

  SwaggerUtils.correctResponses(swagger);

  Assert.assertEquals("response of 200", response.getDescription());
}
 
Example #25
Source File: DeleteOperationGenerator.java    From yang2swagger with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Operation execute(DataSchemaNode node) {
    final Operation delete = defaultOperation();
    delete.summary("removes " + getName(node));
    String description = node.getDescription() == null ? "removes " + getName(node) :
            node.getDescription();
    delete.description(description);
    delete.response(204, new Response().description("Object deleted"));
    return delete;
}
 
Example #26
Source File: RestOperationMeta.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
private boolean checkDownloadFileFlag() {
  // todo: logic of find
  Response response = operationMeta.getSwaggerOperation().getResponses().get("200");
  if (response != null) {
    Model model = response.getResponseSchema();
    return model instanceof ModelImpl &&
        FileProperty.isType(((ModelImpl) model).getType(), ((ModelImpl) model).getFormat());
  }

  return false;
}
 
Example #27
Source File: ResponsesMeta.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
public void init(Swagger swagger, Operation operation) {
  if (responseMap.isEmpty()) {
    responseMap.put(Status.OK.getStatusCode(), OBJECT_JAVA_TYPE);
    initGlobalDefaultMapper();
  }

  for (Entry<String, Response> entry : operation.getResponses().entrySet()) {
    JavaType javaType = ConverterMgr.findJavaType(swagger, entry.getValue().getResponseSchema());

    if ("default".equals(entry.getKey())) {
      defaultResponse = javaType;
      continue;
    }

    Integer statusCode = Integer.parseInt(entry.getKey());
    JavaType existing = responseMap.get(statusCode);
    if (existing == null || !isVoid(javaType)) {
      responseMap.put(statusCode, javaType);
    }
  }

  responseMap.putIfAbsent(ExceptionFactory.CONSUMER_INNER_STATUS_CODE, COMMON_EXCEPTION_JAVA_TYPE);
  responseMap.putIfAbsent(ExceptionFactory.PRODUCER_INNER_STATUS_CODE, COMMON_EXCEPTION_JAVA_TYPE);

  if (defaultResponse == null) {
    // swagger中没有定义default,加上default专用于处理exception
    defaultResponse = OBJECT_JAVA_TYPE;
  }
}
 
Example #28
Source File: TestSwaggerUtils.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
@Test
public void correctResponsesOperation2xxTo200() {
  Response response = new Response();

  Operation operation = new Operation();
  operation.addResponse("default", new Response());
  operation.addResponse("201", response);
  operation.addResponse("301", new Response());

  SwaggerUtils.correctResponses(operation);
  Assert.assertSame(response, operation.getResponses().get("200"));
}
 
Example #29
Source File: DeserializationModule.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
public DeserializationModule(boolean includePathDeserializer,
        boolean includeResponseDeserializer) {

    if (includePathDeserializer) {
        this.addDeserializer(Path.class, new PathDeserializer());
    }
    if (includeResponseDeserializer) {
        this.addDeserializer(Response.class, new ResponseDeserializer());
    }

    this.addDeserializer(Property.class, new PropertyDeserializer());
    this.addDeserializer(Model.class, new ModelDeserializer());
    this.addDeserializer(Parameter.class, new ParameterDeserializer());
    this.addDeserializer(SecuritySchemeDefinition.class, new SecurityDefinitionDeserializer());
}
 
Example #30
Source File: DocumentationDrivenValidator.java    From assertj-swagger with Apache License 2.0 5 votes vote down vote up
private void validateResponseByConfig(Map<String, Response> actualOperationResponses, Map<String, Response> expectedOperationResponses, String message) {
    if(isAssertionEnabled(SwaggerAssertionType.STRICT_VALIDATION_ON_PATH)) {
        softAssertions.assertThat(actualOperationResponses.keySet()).as(message).hasSameElementsAs(expectedOperationResponses.keySet());
    } else {
        softAssertions.assertThat(actualOperationResponses.keySet()).as(message).containsAll(expectedOperationResponses.keySet());
    }
}