• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MarkupLanguage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.github.swagger2markup.markup.builder.MarkupLanguage的典型用法代码示例。如果您正苦于以下问题:Java MarkupLanguage类的具体用法?Java MarkupLanguage怎么用?Java MarkupLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MarkupLanguage类属于io.github.swagger2markup.markup.builder包,在下文中一共展示了MarkupLanguage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Override
public void init(Swagger2MarkupConverter.Context globalContext) {
    Swagger2MarkupProperties extensionsProperties = globalContext.getConfig().getExtensionsProperties();
    contentPath = extensionsProperties.getPathList(extensionId + "." + PROPERTY_CONTENT_PATH);

    if (contentPath.isEmpty()) {
        if (globalContext.getSwaggerLocation() == null || !globalContext.getSwaggerLocation().getScheme().equals("file")) {
            if (logger.isWarnEnabled())
                logger.warn("Disable > DynamicOverviewContentExtension > Can't set default contentPath from swaggerLocation. You have to explicitly configure the content path.");
        } else {
            contentPath.add(Paths.get(globalContext.getSwaggerLocation()).getParent());
        }
    }
    
    Optional<MarkupLanguage> extensionMarkupLanguageProperty = extensionsProperties.getMarkupLanguage(extensionId + "." + PROPERTY_MARKUP_LANGUAGE);
    if (extensionMarkupLanguageProperty.isPresent()) {
        extensionMarkupLanguage = extensionMarkupLanguageProperty.get();
    }
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:20,代码来源:DynamicOverviewDocumentExtension.java


示例2: init

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Override
public void init(Swagger2MarkupConverter.Context globalContext) {
    Swagger2MarkupProperties extensionsProperties = globalContext.getConfig().getExtensionsProperties();
    contentPath = extensionsProperties.getPathList(extensionId + "." + PROPERTY_CONTENT_PATH);
    
    if (contentPath.isEmpty()) {
        if (globalContext.getSwaggerLocation() == null || !globalContext.getSwaggerLocation().getScheme().equals("file")) {
            if (logger.isWarnEnabled())
                logger.warn("Disable DynamicOperationsContentExtension > Can't set default contentPath from swaggerLocation. You have to explicitly configure the content path.");
        } else {
            contentPath.add(Paths.get(globalContext.getSwaggerLocation()).getParent());
        }
    }

    Optional<MarkupLanguage> extensionMarkupLanguageProperty = extensionsProperties.getMarkupLanguage(extensionId + "." + PROPERTY_MARKUP_LANGUAGE);
    if (extensionMarkupLanguageProperty.isPresent()) {
        extensionMarkupLanguage = extensionMarkupLanguageProperty.get();
    }
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:20,代码来源:DynamicPathsDocumentExtension.java


示例3: init

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Override
public void init(Swagger2MarkupConverter.Context globalContext) {
    Swagger2MarkupProperties extensionsProperties = globalContext.getConfig().getExtensionsProperties();
    contentPath = extensionsProperties.getPathList(extensionId + "." + PROPERTY_CONTENT_PATH);
    if (contentPath.isEmpty()) {
        if (globalContext.getSwaggerLocation() == null || !globalContext.getSwaggerLocation().getScheme().equals("file")) {
            if (logger.isWarnEnabled())
                logger.warn("Disable DynamicDefinitionsContentExtension > Can't set default contentPath from swaggerLocation. You have to explicitly configure the content path.");
        } else {
            contentPath.add(Paths.get(globalContext.getSwaggerLocation()).getParent());
        }
    }

    Optional<MarkupLanguage> extensionMarkupLanguageProperty = extensionsProperties.getMarkupLanguage(extensionId + "." + PROPERTY_MARKUP_LANGUAGE);
    if (extensionMarkupLanguageProperty.isPresent()) {
        extensionMarkupLanguage = extensionMarkupLanguageProperty.get();
    }
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:19,代码来源:DynamicDefinitionsDocumentExtension.java


示例4: init

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Override
public void init(Swagger2MarkupConverter.Context globalContext) {
    Swagger2MarkupProperties extensionsProperties = globalContext.getConfig().getExtensionsProperties();
    contentPath = extensionsProperties.getPathList(extensionId + "." + PROPERTY_CONTENT_PATH);
   
    if (contentPath.isEmpty()) {
        if (globalContext.getSwaggerLocation() == null || !globalContext.getSwaggerLocation().getScheme().equals("file")) {
            if (logger.isWarnEnabled())
                logger.warn("Disable > DynamicSecurityContentExtension > Can't set default contentPath from swaggerLocation. You have to explicitly configure the content path.");
        } else {
            contentPath = new ArrayList<Path>();
            contentPath.add(Paths.get(globalContext.getSwaggerLocation()).getParent());
        }
    }

    Optional<MarkupLanguage> extensionMarkupLanguageProperty = extensionsProperties.getMarkupLanguage(extensionId + "." + PROPERTY_MARKUP_LANGUAGE);
    if (extensionMarkupLanguageProperty.isPresent()) {
        extensionMarkupLanguage = extensionMarkupLanguageProperty.get();
    }
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:21,代码来源:DynamicSecurityDocumentExtension.java


示例5: init

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Override
public void init(Swagger2MarkupConverter.Context globalContext) {
    Swagger2MarkupProperties extensionsProperties = globalContext.getConfig().getExtensionsProperties();
    Optional<URI> snippetBaseUriProperty = extensionsProperties.getURI(extensionId + "." + PROPERTY_SNIPPET_BASE_URI);
    boolean withDefaultSnippets = extensionsProperties.getBoolean(extensionId + "." + PROPERTY_DEFAULT_SNIPPETS, true);
    if(withDefaultSnippets){
        withDefaultSnippets();
    }
    if (snippetBaseUriProperty.isPresent()) {
        snippetBaseUri = URIUtils.convertUriWithoutSchemeToFileScheme(snippetBaseUriProperty.get());
    }
    else{
        if (globalContext.getSwaggerLocation() == null) {
            if (logger.isWarnEnabled())
                logger.warn("Disable SpringRestDocsExtension > Can't set default snippetBaseUri from swaggerLocation. You have to explicitly configure the snippetBaseUri.");
        } else {
            snippetBaseUri = URIUtils.uriParent(globalContext.getSwaggerLocation());
        }
    }

    Optional<MarkupLanguage> extensionMarkupLanguageProperty = extensionsProperties.getMarkupLanguage(extensionId + "." + PROPERTY_MARKUP_LANGUAGE);
    if (extensionMarkupLanguageProperty.isPresent()) {
        extensionMarkupLanguage = extensionMarkupLanguageProperty.get();
    }
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:26,代码来源:SpringRestDocsExtension.java


示例6: shouldConvertIntoMarkdown

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Test
public void shouldConvertIntoMarkdown() throws Exception {
    //given
    Map<String, String> config = new HashMap<>();
    config.put(Swagger2MarkupProperties.MARKUP_LANGUAGE, MarkupLanguage.MARKDOWN.toString());

    Swagger2MarkupMojo mojo = new Swagger2MarkupMojo();
    mojo.swaggerInput = new File(INPUT_DIR, SWAGGER_INPUT_FILE).getAbsoluteFile().getAbsolutePath();
    mojo.outputDir = new File(OUTPUT_DIR).getAbsoluteFile();
    mojo.config = config;

    //when
    mojo.execute();

    //then
    Iterable<String> outputFiles = recursivelyListFileNames(mojo.outputDir);
    assertThat(outputFiles).containsOnly("definitions.md", "overview.md", "paths.md", "security.md");
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-maven-plugin,代码行数:19,代码来源:Swagger2MarkupMojoTest.java


示例7: apply

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, Parameters params) {
    DataFrame dataFrame = params.dataFrame;
    java.util.List<MarkupTableColumn> columnSpecs = dataFrame.getColumns().map(column -> {
                Integer widthRatio = Integer.valueOf(column.getMetaData().get(WIDTH_RATIO).getOrElse("0"));
                return new MarkupTableColumn(column.getId().getName())
                        .withWidthRatio(widthRatio)
                        .withHeaderColumn(Boolean.parseBoolean(column.getMetaData().get(HEADER_COLUMN).getOrElse("false")))
                        .withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^" + widthRatio + "a");
            }
    ).toJavaList();

    IndexedSeq<IndexedSeq<String>> columnValues = dataFrame.getColumns()
            .map(column -> ((StringColumn) column).getValues());

    java.util.List<java.util.List<String>> cells = Array.range(0, dataFrame.getRowCount())
            .map(rowNumber -> columnValues.map(values -> values.get(rowNumber)).toJavaList()).toJavaList();

    return markupDocBuilder.tableWithColumnSpecs(columnSpecs, cells);
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:21,代码来源:TableComponent.java


示例8: testWithAsciidocContentInTables

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Test
public void testWithAsciidocContentInTables() throws URISyntaxException {

    //Given
    Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore_with_adoc_content.yaml").toURI());
    Path outputDirectory = Paths.get("build/test/asciidoc/generated");
    FileUtils.deleteQuietly(outputDirectory.toFile());

    //When
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
            .withSwaggerMarkupLanguage(MarkupLanguage.ASCIIDOC)
            .build();

    Swagger2MarkupConverter.from(file).withConfig(config).build()
            .toFolder(outputDirectory);

    //Then
    String[] files = outputDirectory.toFile().list();
    assertThat(files).hasSize(4).containsAll(expectedFiles);

}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:22,代码来源:AsciidocConverterTest.java


示例9: swagger2MarkupConfigFromMap

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
public void swagger2MarkupConfigFromMap() throws IOException {
    Path localSwaggerFile = Paths.get("/path/to/swagger.yaml");

    // tag::swagger2MarkupConfigFromMap[]
    Map<String, String> configMap = new HashMap<>(); //<1>
    configMap.put(Swagger2MarkupProperties.MARKUP_LANGUAGE, MarkupLanguage.MARKDOWN.toString());
    configMap.put(Swagger2MarkupProperties.OUTPUT_LANGUAGE, Language.DE.toString());
    configMap.put(Swagger2MarkupProperties.PATHS_GROUPED_BY, GroupBy.TAGS.toString());

    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder(configMap) //<2>
            .build();

    Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(localSwaggerFile)
            .withConfig(config)
            .build();
    // end::swagger2MarkupConfigFromMap[]
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:18,代码来源:DocumentationTest.java


示例10: testToFolder

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Test
public void testToFolder() throws IOException, URISyntaxException {
    //Given
    Path file = Paths.get(MarkdownConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
    Path outputDirectory = Paths.get("build/test/markdown/to_folder");
    FileUtils.deleteQuietly(outputDirectory.toFile());

    //When
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
            .withMarkupLanguage(MarkupLanguage.MARKDOWN)
            .build();
    Swagger2MarkupConverter.from(file)
            .withConfig(config)
            .build()
            .toFolder(outputDirectory);

    //Then
    String[] files = outputDirectory.toFile().list();
    assertThat(files).hasSize(4).containsAll(expectedFiles);

    Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/markdown/to_folder").toURI());
    DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testToFolder.html");
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:24,代码来源:MarkdownConverterTest.java


示例11: testWithInterDocumentCrossReferences

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Test
public void testWithInterDocumentCrossReferences() throws IOException, URISyntaxException {
    //Given
    Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
    Path outputDirectory = Paths.get("build/test/markdown/idxref");
    FileUtils.deleteQuietly(outputDirectory.toFile());

    //When
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
            .withMarkupLanguage(MarkupLanguage.MARKDOWN)
            .withInterDocumentCrossReferences()
            .build();

    Swagger2MarkupConverter.from(file).withConfig(config).build()
            .toFolder(outputDirectory);

    //Then
    String[] files = outputDirectory.toFile().list();
    assertThat(files).hasSize(4).containsAll(expectedFiles);

    Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/markdown/idxref").toURI());
    DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testWithInterDocumentCrossReferences.html");
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:24,代码来源:MarkdownConverterTest.java


示例12: testWithResponseHeaders

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Test
public void testWithResponseHeaders() throws IOException, URISyntaxException {
    //Given
    Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_response_headers.yaml").toURI());
    Path outputDirectory = Paths.get("build/test/markdown/response_headers");
    FileUtils.deleteQuietly(outputDirectory.toFile());

    //When
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
            .withMarkupLanguage(MarkupLanguage.MARKDOWN)
            .build();
    Swagger2MarkupConverter.from(file)
            .withConfig(config)
            .build()
            .toFolder(outputDirectory);

    //Then
    String[] files = outputDirectory.toFile().list();
    assertThat(files).hasSize(4).containsAll(expectedFiles);

    Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/markdown/response_headers").toURI());
    DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testWithResponseHeaders.html");
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup,代码行数:24,代码来源:MarkdownConverterTest.java


示例13: testParams

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> testParams() {
    return Arrays.asList(new Object[][]{
            {"/swagger.yaml", "yaml/asciidoc", MarkupLanguage.ASCIIDOC},
            {"/swagger.yaml", "yaml/markdown", MarkupLanguage.MARKDOWN},
            {"/swagger.yaml", "yaml/confluence", MarkupLanguage.CONFLUENCE_MARKUP},

            {"/swagger.json", "json/asciidoc", MarkupLanguage.ASCIIDOC},
            {"/swagger.json", "json/markdown", MarkupLanguage.MARKDOWN},
            {"/swagger.json", "json/confluence", MarkupLanguage.CONFLUENCE_MARKUP}
    });
}
 
开发者ID:tsypuk,项目名称:springrestdoc,代码行数:13,代码来源:SwaggerToAsciiDocMarkdownConfluence.java


示例14: extensionsSection

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
/**
 * Builds extension sections
 *
 * @param extensionMarkupLanguage the MarkupLanguage of the snippets content
 * @param contentPaths the path(s) where the content files reside
 * @param prefix      extension file prefix
 * @param levelOffset import markup level offset
 */
public void extensionsSection(MarkupLanguage extensionMarkupLanguage, List<Path> contentPaths, final String prefix, int levelOffset) {
    final Collection<String> filenameExtensions = globalContext.getConfig().getMarkupLanguage().getFileNameExtensions().stream()
            .map(fileExtension -> StringUtils.stripStart(fileExtension, "."))
            .collect(Collectors.toList());

    DirectoryStream.Filter<Path> filter = entry -> {
        String fileName = entry.getFileName().toString();
        return fileName.startsWith(prefix) && FilenameUtils.isExtension(fileName, filenameExtensions);
    };

    for (Path currentPath : contentPaths) {
        try (DirectoryStream<Path> extensionFiles = Files.newDirectoryStream(currentPath, filter)) {

            if (extensionFiles != null) {
                List<Path> extensions = Lists.newArrayList(extensionFiles);
                Collections.sort(extensions, Ordering.natural());

                for (Path extension : extensions) {
                    importContent(extension,
                            (reader) -> contentContext.getMarkupDocBuilder().importMarkup(reader, extensionMarkupLanguage, levelOffset));
                }
            }
        } catch (IOException e) {
            if (logger.isDebugEnabled())
                logger.debug("Failed to read extension files from directory {}", currentPath);
        }
    }
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:37,代码来源:DynamicContentExtension.java


示例15: DynamicOverviewDocumentExtension

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
/**
 * Instantiate extension
 * @param extensionId the unique ID of the extension
 * @param contentPath the base Path where the content is stored
 * @param extensionMarkupLanguage the MarkupLanguage of the extension content
 */
public DynamicOverviewDocumentExtension(String extensionId, List<Path> contentPath, MarkupLanguage extensionMarkupLanguage) {
    super();
    Validate.notNull(extensionMarkupLanguage);
    Validate.notNull(contentPath);
    if(StringUtils.isNoneBlank(extensionId)) {
        this.extensionId = extensionId;
    }
    this.contentPath = contentPath;
    this.extensionMarkupLanguage = extensionMarkupLanguage;
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:17,代码来源:DynamicOverviewDocumentExtension.java


示例16: DynamicPathsDocumentExtension

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
/**
 * Instantiate extension
 * @param extensionId the unique ID of the extension
 * @param contentPath the base Path where the content is stored
 * @param extensionMarkupLanguage the MarkupLanguage of the extension content
 */
public DynamicPathsDocumentExtension(String extensionId, List<Path> contentPath, MarkupLanguage extensionMarkupLanguage) {
    super();
    Validate.notNull(extensionMarkupLanguage);
    Validate.notNull(contentPath);
    if(StringUtils.isNoneBlank(extensionId)) {
        this.extensionId = extensionId;
    }
    this.contentPath = contentPath;
    this.extensionMarkupLanguage = extensionMarkupLanguage;
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:17,代码来源:DynamicPathsDocumentExtension.java


示例17: DynamicDefinitionsDocumentExtension

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
/**
 * Instantiate extension
 * @param extensionId the unique ID of the extension
 * @param contentPath the base Path where the content is stored
 * @param extensionMarkupLanguage the MarkupLanguage of the extension content
 */
public DynamicDefinitionsDocumentExtension(String extensionId, List<Path> contentPath, MarkupLanguage extensionMarkupLanguage) {
    super();
    Validate.notNull(extensionMarkupLanguage);
    Validate.notNull(contentPath);
    if(StringUtils.isNoneBlank(extensionId)) {
        this.extensionId = extensionId;
    }
    this.contentPath = contentPath;
    this.extensionMarkupLanguage = extensionMarkupLanguage;
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:17,代码来源:DynamicDefinitionsDocumentExtension.java


示例18: DynamicSecurityDocumentExtension

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
/**
 * Instantiate extension
 * @param extensionId the unique ID of the extension
 * @param contentPath the base Path where the content is stored
 * @param extensionMarkupLanguage the MarkupLanguage of the extension content
 */
public DynamicSecurityDocumentExtension(String extensionId, List<Path> contentPath, MarkupLanguage extensionMarkupLanguage) {
    super();
    Validate.notNull(extensionMarkupLanguage);
    Validate.notNull(contentPath);
    if(StringUtils.isNoneBlank(extensionId)) {
        this.extensionId = extensionId;
    }
    this.contentPath = contentPath;
    this.extensionMarkupLanguage = extensionMarkupLanguage;
}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:17,代码来源:DynamicSecurityDocumentExtension.java


示例19: testSwagger2MarkdownExtensions

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Test
public void testSwagger2MarkdownExtensions() throws IOException, URISyntaxException {
    //Given
    Path file = Paths.get(DynamicDocumentExtensionTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
    Path outputDirectory = Paths.get("build/test/markdown/generated");
    FileUtils.deleteQuietly(outputDirectory.toFile());

    //When
    Properties properties = new Properties();
    properties.load(DynamicDocumentExtensionTest.class.getResourceAsStream("/config/markdown/config.properties"));
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder(properties)
            .withMarkupLanguage(MarkupLanguage.MARKDOWN)
            .build();
    Swagger2MarkupExtensionRegistry registry = new Swagger2MarkupExtensionRegistryBuilder()
            //.withDefinitionsDocumentExtension(new DynamicDefinitionsDocumentExtension(Paths.get("src/test/resources/docs/markdown/extensions")))
            //.withPathsDocumentExtension(new DynamicPathsDocumentExtension(Paths.get("src/test/resources/docs/markdown/extensions")))
            .build();
    Swagger2MarkupConverter.from(file)
            .withConfig(config)
            .withExtensionRegistry(registry)
            .build()
            .toFolder(outputDirectory);

    //Then
    assertThat(new String(Files.readAllBytes(outputDirectory.resolve("paths.md")))).contains(
            "Pet update request extension");
    assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.md")))).contains(
            "Pet extension");

}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:31,代码来源:DynamicDocumentExtensionTest.java


示例20: testSwagger2MarkdownExtensionsMultiContentFolders

import io.github.swagger2markup.markup.builder.MarkupLanguage; //导入依赖的package包/类
@Test
public void testSwagger2MarkdownExtensionsMultiContentFolders() throws IOException, URISyntaxException {
    //Given
    Path file = Paths.get(DynamicDocumentExtensionTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
    Path outputDirectory = Paths.get("build/test/markdown/generated");
    FileUtils.deleteQuietly(outputDirectory.toFile());

    //When
    Properties properties = new Properties();
    properties.load(DynamicDocumentExtensionTest.class.getResourceAsStream("/config/markdown/config2.properties"));
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder(properties)
            .withMarkupLanguage(MarkupLanguage.MARKDOWN)
            .build();
    Swagger2MarkupExtensionRegistry registry = new Swagger2MarkupExtensionRegistryBuilder()
            //.withDefinitionsDocumentExtension(new DynamicDefinitionsDocumentExtension(Paths.get("src/test/resources/docs/markdown/extensions")))
            //.withPathsDocumentExtension(new DynamicPathsDocumentExtension(Paths.get("src/test/resources/docs/markdown/extensions")))
            .build();
    Swagger2MarkupConverter.from(file)
            .withConfig(config)
            .withExtensionRegistry(registry)
            .build()
            .toFolder(outputDirectory);

    //Then
    assertThat(new String(Files.readAllBytes(outputDirectory.resolve("paths.md")))).contains(
            "Pet update request extension").contains("Pet update request extension 2");
    assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.md")))).contains(
            "Pet extension").contains("Pet extension 2");

}
 
开发者ID:Swagger2Markup,项目名称:swagger2markup-extensions,代码行数:31,代码来源:DynamicDocumentExtensionTest.java



注:本文中的io.github.swagger2markup.markup.builder.MarkupLanguage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ListTemplatesAction类代码示例发布时间:2022-05-22
下一篇:
Java SnapshotArtifactRepositoryMetadata类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap