public class OpenAPICodegenUtils extends Object
| Constructor and Description |
|---|
OpenAPICodegenUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
convertYamlToJson(String yaml) |
static String |
findSwaggerVersion(String apiDefinition,
boolean isFilePath)
Discover the openAPI version of the given API definition
|
static ExtendedAPI |
generateAPIFromOpenAPIDef(io.swagger.v3.oas.models.OpenAPI openAPI,
String openAPIContent,
Path openAPIPath)
generate ExtendedAPI object from openAPI definition
|
static List<APIKey> |
generateAPIKeysFromSecurity(List<io.swagger.v3.oas.models.security.SecurityRequirement> securityRequirementList)
Provide api keys for a given security requirement list
|
static List<String> |
getAuthProviders(String schemas) |
static String |
getMgwResourceScope(io.swagger.v3.oas.models.Operation operation)
Get resource level security scopes of
Operation if the security scheme is oauth2. |
static List<String> |
getMgwResourceSecurity(io.swagger.v3.oas.models.Operation operation) |
static String |
getOpenAPIAsJson(io.swagger.v3.oas.models.OpenAPI openAPI,
String openAPIContent,
Path openAPIPath)
Convert the v2 or v3 open API definition in yaml or json format into json format of the respective format
v2/YAML -> v2/JSON
v3/YAML -> v3/JSON
|
static MgwEndpointConfigDTO |
getResourceEpConfigForCodegen(io.swagger.v3.oas.models.Operation operation)
get resource Endpoint configuration in the format of
MgwEndpointConfigDTO to match the mustache
template |
static void |
setAdditionalConfig(ExtendedAPI api) |
static void |
setAdditionalConfigsDevFirst(ExtendedAPI api,
io.swagger.v3.oas.models.OpenAPI openAPI,
String openAPIFilePath) |
static void |
setInterceptors(String projectName)
Store all the interceptor functions included in interceptors directory.
|
static void |
validateOpenAPIDefinition(io.swagger.v3.oas.models.OpenAPI openAPI,
String openAPIFilePath,
String openAPIVersion)
validate the openAPI definition
|
public static String findSwaggerVersion(String apiDefinition, boolean isFilePath)
apiDefinition - API definition (as a file path or String content)isFilePath - If the given api Definition is a file pathpublic static String getOpenAPIAsJson(io.swagger.v3.oas.models.OpenAPI openAPI, String openAPIContent, Path openAPIPath)
openAPIContent - open API as a string contentpublic static String convertYamlToJson(String yaml) throws IOException
IOExceptionpublic static ExtendedAPI generateAPIFromOpenAPIDef(io.swagger.v3.oas.models.OpenAPI openAPI, String openAPIContent, Path openAPIPath) throws IOException
openAPI - OpenAPI objectIOExceptionpublic static void setAdditionalConfig(ExtendedAPI api)
public static void setAdditionalConfigsDevFirst(ExtendedAPI api, io.swagger.v3.oas.models.OpenAPI openAPI, String openAPIFilePath)
public static MgwEndpointConfigDTO getResourceEpConfigForCodegen(io.swagger.v3.oas.models.Operation operation)
MgwEndpointConfigDTO to match the mustache
templateoperation - Operation objectMgwEndpointConfigDTO objectpublic static void setInterceptors(String projectName) throws IOException
IOException - if an error occurred while reading the bal files inside interceptor directorypublic static List<String> getMgwResourceSecurity(io.swagger.v3.oas.models.Operation operation)
public static String getMgwResourceScope(io.swagger.v3.oas.models.Operation operation)
Operation if the security scheme is oauth2.operation - Operationpublic static List<APIKey> generateAPIKeysFromSecurity(List<io.swagger.v3.oas.models.security.SecurityRequirement> securityRequirementList)
securityRequirementList - List objectpublic static void validateOpenAPIDefinition(io.swagger.v3.oas.models.OpenAPI openAPI,
String openAPIFilePath,
String openAPIVersion)
openAPI - OpenAPI objectopenAPIFilePath - file path to openAPI definitionCopyright © 2020 WSO2. All rights reserved.