本文整理汇总了Java中io.swagger.models.Swagger.setDefinitions方法的典型用法代码示例。如果您正苦于以下问题:Java Swagger.setDefinitions方法的具体用法?Java Swagger.setDefinitions怎么用?Java Swagger.setDefinitions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.Swagger
的用法示例。
在下文中一共展示了Swagger.setDefinitions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import io.swagger.models.Swagger; //导入方法依赖的package包/类
public static Swagger parse(String requestUrl, Collection<UrlMapper> collection) {
Swagger swagger = parseCommon(requestUrl, null);
List<Tag> tags = new ArrayList<Tag>();
Map<String, Path> paths = new HashMap<String, Path>();
Map<String, Model> models = new HashMap<String, Model>();
for (UrlMapper urlMapper : collection) {
if (urlMapper != null) {
Swagger p_swagger = parse(requestUrl, urlMapper);
if (p_swagger != null) {
if (p_swagger != null) {
tags.addAll(p_swagger.getTags());
paths.putAll(p_swagger.getPaths());
models.putAll(p_swagger.getDefinitions());
}
}
}
}
swagger.setTags(tags);
swagger.setPaths(paths);
swagger.setDefinitions(models);
return swagger;
}
示例2: appendDefinition
import io.swagger.models.Swagger; //导入方法依赖的package包/类
public static void appendDefinition(Swagger swagger, Map<String, Model> newDefinitions) {
if (newDefinitions.isEmpty()) {
return;
}
Map<String, Model> definitions = swagger.getDefinitions();
if (definitions == null) {
definitions = new LinkedHashMap<>();
swagger.setDefinitions(definitions);
}
definitions.putAll(newDefinitions);
}
示例3: mockDefinition
import io.swagger.models.Swagger; //导入方法依赖的package包/类
private Swagger mockDefinition() throws IOException {
byte[] bytes = "spec".getBytes(Charsets.UTF_8);
when(fileResourceMock.getInputStream()).thenReturn(new ByteArrayInputStream(bytes));
when(((ResourcePatternResolver) resourceLoader).getResources(anyString())).thenReturn(
new org.springframework.core.io.Resource[] {fileResourceMock});
Map<String, Model> definitions = new HashMap<>();
Model myref = new ModelImpl();
definitions.put("myref", myref);
Swagger swagger = (new Swagger()).info(new Info().description(DBEERPEDIA.OPENAPI_DESCRIPTION));
swagger.setDefinitions(definitions);
when(openApiParserMock.parse("spec")).thenReturn(swagger);
return swagger;
}
示例4: update
import io.swagger.models.Swagger; //导入方法依赖的package包/类
public Swagger update(Swagger orig, Swagger schemaToBe) {
if(orig == null ){
return schemaToBe;
}
Map<String, Path> mergedPaths = mergePathDefinitions(orig, schemaToBe);
Map<String, Model> mergedModels = mergedModelDefinitions(orig, schemaToBe);
orig.setPaths(mergedPaths);
orig.setDefinitions(mergedModels);
logger.debug("Modified swagger is: "+ orig);
return orig;
}