本文整理了Java中io.swagger.v3.oas.models.OpenAPI.addExtension()
方法的一些代码示例,展示了OpenAPI.addExtension()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OpenAPI.addExtension()
方法的具体详情如下:
包路径:io.swagger.v3.oas.models.OpenAPI
类名称:OpenAPI
方法名:addExtension
暂无
代码示例来源:origin: swagger-api/swagger-core
@Test
public void testExtension() throws Exception {
OpenAPI swagger = new OpenAPI();
swagger.addExtension("x-foo-bar", "foo bar");
swagger.setInfo(new Info());
swagger.getInfo().addExtension("x-foo-bar", "foo bar");
String swaggerJson = Json.mapper().writeValueAsString(swagger);
assertFalse(swaggerJson.contains("extensions"));
OpenAPI rebuilt = Json.mapper().readValue(swaggerJson, OpenAPI.class);
assertEquals(rebuilt.getExtensions().values().iterator().next(), "foo bar");
assertEquals(rebuilt.getInfo().getExtensions().values().iterator().next(), "foo bar");
}
代码示例来源:origin: com.atlassian.swagger/atlassian-swagger-doclet
public OpenAPI addNarrativeDocs(OpenAPI openAPI) {
if (docletOptions.hasNarrativeDocs()) {
openAPI.addExtension("x-atlassian-narrative", docletOptions.getNarrativeDocs());
}
return openAPI;
}
}
内容来源于网络,如有侵权,请联系作者删除!