public class SwaggerConverterUtils extends Object
| Constructor and Description |
|---|
SwaggerConverterUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
capitalize(String str) |
static String |
generateBallerinaDataModel(String swaggerDefinition,
String ballerinaDefinition)
This method will generate ballerina string from swagger definition.
|
static String |
generateServiceUUID(String path,
String verb)
This will generate UUID specific to given resource.
|
static String |
generateSwaggerDataModel(String ballerinaDefinition)
This method will convert ballerina definition to swagger string.
|
static org.ballerinalang.model.BallerinaFile |
getBFileFromBallerinaDefinition(String ballerinaDefinition)
Generate ballerina fine from the String definition
|
static org.ballerinalang.model.Service |
getServiceFromSwaggerDefinition(String swaggerDefinition)
This method will generate Ballerina service from Swagger definition.
|
static org.ballerinalang.model.Service[] |
getServicesFromBallerinaDefinition(String ballerinaDefinition)
This method will extract service definitions from ballerina source
|
static boolean |
isResourceUUIDMatch(org.ballerinalang.model.Resource swaggerResource,
org.ballerinalang.model.Resource ballerinaResource)
Check if 2 resources are having same UUID.
|
static org.ballerinalang.model.Resource[] |
mapPathsToResources(Map<String,io.swagger.models.Path> pathMap) |
static org.ballerinalang.model.Resource[] |
mapSwaggerPathsToResources(List<io.swagger.codegen.CodegenOperation> pathMap)
This method will convert swagger path List into ballerina @Resource array
|
static org.ballerinalang.model.Annotation[] |
mergeAnnotations(org.ballerinalang.model.Annotation[] annotations,
org.ballerinalang.model.Annotation[] annotationsToMerge)
This method will merge annotations from two different services or resources.
|
static org.ballerinalang.model.Service |
mergeBallerinaService(org.ballerinalang.model.Service ballerinaService,
org.ballerinalang.model.Service swaggerService)
This method will merge swagger definition based to ballerina service.
|
static org.ballerinalang.model.Resource[] |
mergeResources(List<org.ballerinalang.model.Resource> resourceList,
org.ballerinalang.model.Resource[] resources)
Remove duplicate resources and merge them.
|
public static org.ballerinalang.model.Service[] getServicesFromBallerinaDefinition(String ballerinaDefinition) throws IOException
ballerinaDefinition - service definition to be process as ballerinaIOException - when input stream handling error.public static org.ballerinalang.model.BallerinaFile getBFileFromBallerinaDefinition(String ballerinaDefinition) throws IOException
ballerinaDefinition - ballerina string definitionIOException - IO exceptionpublic static org.ballerinalang.model.Service getServiceFromSwaggerDefinition(String swaggerDefinition) throws IOException
swaggerDefinition - Swagger definitionIOException - IO exceptionpublic static org.ballerinalang.model.Resource[] mapSwaggerPathsToResources(List<io.swagger.codegen.CodegenOperation> pathMap)
pathMap - Swagger @CodegenOperation list to be processedpublic static org.ballerinalang.model.Resource[] mapPathsToResources(Map<String,io.swagger.models.Path> pathMap)
pathMap - Swagger path mappublic static org.ballerinalang.model.Service mergeBallerinaService(org.ballerinalang.model.Service ballerinaService,
org.ballerinalang.model.Service swaggerService)
ballerinaService - ballerina serviceswaggerService - swagger servicepublic static org.ballerinalang.model.Annotation[] mergeAnnotations(org.ballerinalang.model.Annotation[] annotations,
org.ballerinalang.model.Annotation[] annotationsToMerge)
annotations - annotations arrayannotationsToMerge - annotations array to mergepublic static boolean isResourceUUIDMatch(org.ballerinalang.model.Resource swaggerResource,
org.ballerinalang.model.Resource ballerinaResource)
swaggerResource - Swagger resourceballerinaResource - Ballerina resourcespublic static String generateServiceUUID(String path, String verb)
path - pathverb - verbpublic static org.ballerinalang.model.Resource[] mergeResources(List<org.ballerinalang.model.Resource> resourceList, org.ballerinalang.model.Resource[] resources)
resourceList - resources listresources - resources arraypublic static String generateSwaggerDataModel(String ballerinaDefinition) throws IOException
ballerinaDefinition - String ballerina config to be processed as ballerina service definitionIOException - when input process error occur.public static String generateBallerinaDataModel(String swaggerDefinition, String ballerinaDefinition) throws IOException
swaggerDefinition - swagger definition to be processed as swaggerballerinaDefinition - ballerina definition to be process as ballerina definitionIOException - when error occur while processing input swagger and ballerina definitions.Copyright © 2017 WSO2. All rights reserved.