public class ModelUtils extends Object
| 构造器和说明 |
|---|
ModelUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static io.swagger.v3.oas.models.media.Schema |
getAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema) |
static List<String> |
getAllUsedSchemas(io.swagger.v3.oas.models.OpenAPI openAPI)
Return the list of all schemas in the 'components/schemas' section used in the openAPI specification
|
static io.swagger.v3.oas.models.responses.ApiResponse |
getApiResponse(io.swagger.v3.oas.models.OpenAPI openAPI,
String name) |
static io.swagger.v3.oas.models.callbacks.Callback |
getCallback(io.swagger.v3.oas.models.OpenAPI openAPI,
String name) |
static io.swagger.v3.oas.models.headers.Header |
getHeader(io.swagger.v3.oas.models.OpenAPI openAPI,
String name) |
static CodegenModel |
getModelByName(String name,
Map<String,Object> models)
Searches for the model by name in the map of models and returns it
|
static io.swagger.v3.oas.models.parameters.Parameter |
getParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
String name) |
static io.swagger.v3.oas.models.responses.ApiResponse |
getReferencedApiResponse(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.responses.ApiResponse apiResponse)
If a ApiResponse contains a reference to an other ApiResponse with '$ref', returns the referenced ApiResponse if it is found or the actual ApiResponse in the other cases.
|
static io.swagger.v3.oas.models.callbacks.Callback |
getReferencedCallback(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.callbacks.Callback callback)
If a Callback contains a reference to an other Callback with '$ref', returns the referenced Callback if it is found or the actual Callback in the other cases.
|
static io.swagger.v3.oas.models.headers.Header |
getReferencedHeader(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.headers.Header header) |
static io.swagger.v3.oas.models.parameters.Parameter |
getReferencedParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.parameters.Parameter parameter)
If a Parameter contains a reference to an other Parameter with '$ref', returns the referenced Parameter if it is found or the actual Parameter in the other cases.
|
static io.swagger.v3.oas.models.parameters.RequestBody |
getReferencedRequestBody(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.parameters.RequestBody requestBody)
If a RequestBody contains a reference to an other RequestBody with '$ref', returns the referenced RequestBody if it is found or the actual RequestBody in the other cases.
|
static io.swagger.v3.oas.models.media.Schema |
getReferencedSchema(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.media.Schema schema)
If a Schema contains a reference to another Schema with '$ref', returns the referenced Schema if it is found or the actual Schema in the other cases.
|
static io.swagger.v3.oas.models.parameters.RequestBody |
getRequestBody(io.swagger.v3.oas.models.OpenAPI openAPI,
String name) |
static io.swagger.v3.oas.models.media.Schema |
getSchema(io.swagger.v3.oas.models.OpenAPI openAPI,
String name) |
static io.swagger.v3.oas.models.media.Schema |
getSchemaFromRequestBody(io.swagger.v3.oas.models.parameters.RequestBody requestBody)
Return the first defined Schema for a RequestBody
|
static io.swagger.v3.oas.models.media.Schema |
getSchemaFromResponse(io.swagger.v3.oas.models.responses.ApiResponse response)
Return the first defined Schema for a ApiResponse
|
static Map<String,io.swagger.v3.oas.models.media.Schema> |
getSchemas(io.swagger.v3.oas.models.OpenAPI openAPI) |
static List<String> |
getSchemasUsedOnlyInFormParam(io.swagger.v3.oas.models.OpenAPI openAPI)
Return the list of schemas in the 'components/schemas' used only in a 'application/x-www-form-urlencoded' or 'multipart/form-data' mime time
|
static String |
getSimpleRef(String ref) |
static List<String> |
getUnusedSchemas(io.swagger.v3.oas.models.OpenAPI openAPI)
Return the list of unused schemas in the 'components/schemas' section of an openAPI specification
|
static boolean |
isArraySchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isBinarySchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isBooleanSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isByteArraySchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isComposedSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isDateSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isDateTimeSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isDoubleSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isEmailSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isFileSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isFloatSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isFreeFormObject(io.swagger.v3.oas.models.media.Schema schema)
Check to see if the schema is a free form object
|
static boolean |
isIntegerSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isLongSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isMapSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isModel(io.swagger.v3.oas.models.media.Schema schema)
Check to see if the schema is a model with at least one properties
|
static boolean |
isNumberSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isObjectSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isPasswordSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isShortchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isStringSchema(io.swagger.v3.oas.models.media.Schema schema) |
static boolean |
isUUIDSchema(io.swagger.v3.oas.models.media.Schema schema) |
static io.swagger.v3.oas.models.media.Schema |
unaliasSchema(Map<String,io.swagger.v3.oas.models.media.Schema> allSchemas,
io.swagger.v3.oas.models.media.Schema schema)
Get the actual schema from aliases.
|
public static CodegenModel getModelByName(String name, Map<String,Object> models)
name - Name of the modelmodels - Map of modelspublic static List<String> getAllUsedSchemas(io.swagger.v3.oas.models.OpenAPI openAPI)
openAPI - specificationpublic static List<String> getUnusedSchemas(io.swagger.v3.oas.models.OpenAPI openAPI)
openAPI - specificationpublic static List<String> getSchemasUsedOnlyInFormParam(io.swagger.v3.oas.models.OpenAPI openAPI)
openAPI - specificationpublic static boolean isObjectSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isComposedSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isMapSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isArraySchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isStringSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isIntegerSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isShortchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isLongSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isBooleanSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isNumberSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isFloatSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isDoubleSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isDateSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isDateTimeSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isPasswordSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isByteArraySchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isBinarySchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isFileSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isUUIDSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isEmailSchema(io.swagger.v3.oas.models.media.Schema schema)
public static boolean isModel(io.swagger.v3.oas.models.media.Schema schema)
schema - potentially containing a '$ref'public static boolean isFreeFormObject(io.swagger.v3.oas.models.media.Schema schema)
schema - potentially containing a '$ref'public static io.swagger.v3.oas.models.media.Schema getReferencedSchema(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.media.Schema schema)
openAPI - specification being checkedschema - potentially containing a '$ref'public static io.swagger.v3.oas.models.media.Schema getSchema(io.swagger.v3.oas.models.OpenAPI openAPI,
String name)
public static Map<String,io.swagger.v3.oas.models.media.Schema> getSchemas(io.swagger.v3.oas.models.OpenAPI openAPI)
public static io.swagger.v3.oas.models.parameters.RequestBody getReferencedRequestBody(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.parameters.RequestBody requestBody)
openAPI - specification being checkedrequestBody - potentially containing a '$ref'public static io.swagger.v3.oas.models.parameters.RequestBody getRequestBody(io.swagger.v3.oas.models.OpenAPI openAPI,
String name)
public static io.swagger.v3.oas.models.responses.ApiResponse getReferencedApiResponse(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.responses.ApiResponse apiResponse)
openAPI - specification being checkedapiResponse - potentially containing a '$ref'public static io.swagger.v3.oas.models.responses.ApiResponse getApiResponse(io.swagger.v3.oas.models.OpenAPI openAPI,
String name)
public static io.swagger.v3.oas.models.parameters.Parameter getReferencedParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.parameters.Parameter parameter)
openAPI - specification being checkedparameter - potentially containing a '$ref'public static io.swagger.v3.oas.models.parameters.Parameter getParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
String name)
public static io.swagger.v3.oas.models.callbacks.Callback getReferencedCallback(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.callbacks.Callback callback)
openAPI - specification being checkedcallback - potentially containing a '$ref'public static io.swagger.v3.oas.models.callbacks.Callback getCallback(io.swagger.v3.oas.models.OpenAPI openAPI,
String name)
public static io.swagger.v3.oas.models.media.Schema getSchemaFromRequestBody(io.swagger.v3.oas.models.parameters.RequestBody requestBody)
requestBody - request body of the operationpublic static io.swagger.v3.oas.models.media.Schema getSchemaFromResponse(io.swagger.v3.oas.models.responses.ApiResponse response)
response - api response of the operationpublic static io.swagger.v3.oas.models.media.Schema unaliasSchema(Map<String,io.swagger.v3.oas.models.media.Schema> allSchemas, io.swagger.v3.oas.models.media.Schema schema)
allSchemas - all schemasschema - schema (alias or direct reference)public static io.swagger.v3.oas.models.media.Schema getAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema)
public static io.swagger.v3.oas.models.headers.Header getReferencedHeader(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.headers.Header header)
public static io.swagger.v3.oas.models.headers.Header getHeader(io.swagger.v3.oas.models.OpenAPI openAPI,
String name)
Copyright © 2019. All rights reserved.