Package com.github.kongchen.swagger.docgen

Examples of com.github.kongchen.swagger.docgen.AbstractDocumentSource


        try {
            getLog().debug(apiSources.toString());
            for (ApiSource apiSource : apiSources) {

                AbstractDocumentSource documentSource = new MavenDocumentSource(apiSource, getLog());
                documentSource.loadOverridingModels();
                documentSource.loadDocuments();
        if (apiSource.getOutputPath() != null){
          File outputDirectory = new File(apiSource.getOutputPath()).getParentFile();
          if (outputDirectory != null && !outputDirectory.exists()) {
            if (!outputDirectory.mkdirs()) {
              throw new MojoExecutionException("Create directory[" +
                  apiSource.getOutputPath() + "] for output failed.");
            }
          }
        }
        if (apiSource.getOutputTemplate()!=null)
        {
          documentSource.toDocuments();
        }
                documentSource.toSwaggerDocuments(
                        apiSource.getSwaggerUIDocBasePath() == null
                                ? apiSource.getBasePath()
                                : apiSource.getSwaggerUIDocBasePath());
            }
View Full Code Here


    @Test
    public void testIssue17() throws Exception, GenerateException {
    ApiSource apiSource = prepare();
        String locations = apiSource.getLocations();
        apiSource.setLocations("issue17");
        AbstractDocumentSource documentSource = new MavenDocumentSource(apiSource, new SystemStreamLog());
        documentSource.loadDocuments();
        OutputTemplate outputTemplate = new OutputTemplate(documentSource);
        Assert.assertEquals(outputTemplate.getDataTypes().size(), 1);
        Assert.assertEquals(outputTemplate.getDataTypes().iterator().next().getName(), "Child");
        // set back
        apiSource.setLocations(locations);
View Full Code Here

    }

    @Test
    public void test() throws Exception, GenerateException {
    ApiSource apiSource = prepare();
        AbstractDocumentSource documentSource = new MavenDocumentSource(apiSource, new SystemStreamLog());
        documentSource.loadDocuments();
        OutputTemplate outputTemplate = new OutputTemplate(documentSource);
        assertEquals(apiSource.getApiVersion(), outputTemplate.getApiVersion());
        assertEquals(3, outputTemplate.getApiDocuments().size());
        for (MustacheDocument doc : outputTemplate.getApiDocuments()) {
            if (doc.getIndex() == 1) {
View Full Code Here

  @Test
  public void testSwaggerFilter() throws Exception, GenerateException {
    ApiSource apiSource = prepare();
    apiSource.setSwaggerInternalFilter(TestSwaggerSpecFilter.class.getName());
    AbstractDocumentSource documentSource = new MavenDocumentSource(apiSource, new SystemStreamLog());
    documentSource.loadDocuments();
    OutputTemplate outputTemplate = new OutputTemplate(documentSource);
    assertEquals(apiSource.getApiVersion(), outputTemplate.getApiVersion());
    assertEquals(3, outputTemplate.getApiDocuments().size());
    for (MustacheDocument doc : outputTemplate.getApiDocuments()) {
      if (doc.getIndex() == 1) {
View Full Code Here

  @Test
  public void testSwaggerApiReader() throws Exception {
    ApiSource apiSource = prepare();
    apiSource.setSwaggerApiReader(TestSwaggerApiReader.class.getName());
    AbstractDocumentSource documentSource = new MavenDocumentSource(apiSource, new SystemStreamLog());
    documentSource.loadDocuments();
    OutputTemplate outputTemplate = new OutputTemplate(documentSource);
    assertEquals(apiSource.getApiVersion(), outputTemplate.getApiVersion());
    assertEquals(3, outputTemplate.getApiDocuments().size());
    for (MustacheDocument doc : outputTemplate.getApiDocuments()) {
      if (doc.getIndex() == 1) {
View Full Code Here

  }

  @Test
  public void testSwaggerApiReaderDefaultConfig() throws Exception {
    ApiSource apiSource = prepare();
    AbstractDocumentSource documentSource = new MavenDocumentSource(apiSource, new SystemStreamLog());
    documentSource.loadDocuments();
    OutputTemplate outputTemplate = new OutputTemplate(documentSource);
    assertEquals(apiSource.getApiVersion(), outputTemplate.getApiVersion());
    assertEquals(3, outputTemplate.getApiDocuments().size());
    for (MustacheDocument doc : outputTemplate.getApiDocuments()) {
      if (doc.getIndex() == 1) {
View Full Code Here

TOP

Related Classes of com.github.kongchen.swagger.docgen.AbstractDocumentSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.