Search in sources :

Example 1 with OpenAPIDefinitionValidationResponseInfoDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OpenAPIDefinitionValidationResponseInfoDTO in project carbon-apimgt by wso2.

the class APIMappingUtil method getOpenAPIDefinitionValidationResponseFromModel.

public static OpenAPIDefinitionValidationResponseDTO getOpenAPIDefinitionValidationResponseFromModel(APIDefinitionValidationResponse model, boolean returnContent) {
    OpenAPIDefinitionValidationResponseDTO responseDTO = new OpenAPIDefinitionValidationResponseDTO();
    responseDTO.setIsValid(model.isValid());
    if (model.isValid()) {
        APIDefinitionValidationResponse.Info modelInfo = model.getInfo();
        if (modelInfo != null) {
            OpenAPIDefinitionValidationResponseInfoDTO infoDTO = new OpenAPIDefinitionValidationResponseInfoDTO();
            infoDTO.setOpenAPIVersion(modelInfo.getOpenAPIVersion());
            infoDTO.setName(modelInfo.getName());
            infoDTO.setVersion(modelInfo.getVersion());
            infoDTO.setContext(modelInfo.getContext());
            infoDTO.setDescription(modelInfo.getDescription());
            infoDTO.setEndpoints(modelInfo.getEndpoints());
            responseDTO.setInfo(infoDTO);
        }
        if (returnContent) {
            responseDTO.setContent(model.getContent());
        }
    } else {
        responseDTO.setErrors(getErrorListItemsDTOsFromErrorHandlers(model.getErrorItems()));
    }
    return responseDTO;
}
Also used : OpenAPIDefinitionValidationResponseInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OpenAPIDefinitionValidationResponseInfoDTO) OpenAPIDefinitionValidationResponseDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OpenAPIDefinitionValidationResponseDTO) APIDefinitionValidationResponse(org.wso2.carbon.apimgt.api.APIDefinitionValidationResponse)

Aggregations

APIDefinitionValidationResponse (org.wso2.carbon.apimgt.api.APIDefinitionValidationResponse)1 OpenAPIDefinitionValidationResponseDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OpenAPIDefinitionValidationResponseDTO)1 OpenAPIDefinitionValidationResponseInfoDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OpenAPIDefinitionValidationResponseInfoDTO)1