Search in sources :

Example 21 with Document

use of io.apicurio.datamodels.core.models.Document in project syndesis by syndesisio.

the class ProjectDSLGeneratorTest method testGenerateRestDSL.

// ***************************
// Tests
// ***************************
@Test
public void testGenerateRestDSL() throws Exception {
    final InputStream is = this.getClass().getResourceAsStream("/io/syndesis/server/runtime/task-api.json");
    byte[] openApiBytes = IOUtils.toByteArray(is);
    final Document openApiDoc = Library.readDocumentFromJSONString(new String(openApiBytes, StandardCharsets.UTF_8));
    final StringBuilder code = new StringBuilder();
    RestDslGenerator.toAppendable((OasDocument) openApiDoc).withClassName("RestRoute").withPackageName("io.syndesis.example").withoutSourceCodeTimestamps().generate(code);
    Assert.assertTrue(code.length() > 0);
}
Also used : InputStream(java.io.InputStream) OasDocument(io.apicurio.datamodels.openapi.models.OasDocument) Document(io.apicurio.datamodels.core.models.Document) Test(org.junit.Test)

Aggregations

Document (io.apicurio.datamodels.core.models.Document)21 Node (io.apicurio.datamodels.core.models.Node)7 Oas30Document (io.apicurio.datamodels.openapi.v3.models.Oas30Document)7 URL (java.net.URL)7 Description (org.junit.runner.Description)6 Statement (org.junit.runners.model.Statement)6 DocumentType (io.apicurio.datamodels.core.models.DocumentType)5 NodePath (io.apicurio.datamodels.core.models.NodePath)4 ValidationProblem (io.apicurio.datamodels.core.models.ValidationProblem)4 OasDocument (io.apicurio.datamodels.openapi.models.OasDocument)4 Oas20Document (io.apicurio.datamodels.openapi.v2.models.Oas20Document)4 Test (org.junit.Test)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 Aai20Document (io.apicurio.datamodels.asyncapi.v2.models.Aai20Document)2 DataModelReader (io.apicurio.datamodels.core.io.DataModelReader)2 ValidationProblemSeverity (io.apicurio.datamodels.core.models.ValidationProblemSeverity)2 IDocumentValidatorExtension (io.apicurio.datamodels.core.validation.IDocumentValidatorExtension)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 CompletableFuture (java.util.concurrent.CompletableFuture)2