From 3d84da81cd939be9ad69f77dba455a861b9d0194 Mon Sep 17 00:00:00 2001 From: Sylvain Durand Date: Wed, 17 Jul 2024 15:35:43 +0200 Subject: [PATCH] feat(blocktype): add documentation entry --- README.adoc | 5 ++++- pom.xml | 2 +- .../java/sipa/blockprovider/BlockTypeBuilder.java | 11 +++++++++++ .../sipa/blockprovider/domain/BlockConfiguration.java | 11 +++++++++++ .../examples/BlockTypeWithEndpointTest.java | 3 +++ .../examples/BlockTypeWithoutEndpointTest.java | 3 +++ 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index 20e7e8c..b323310 100644 --- a/README.adoc +++ b/README.adoc @@ -18,7 +18,7 @@ You simply need to generate the object and let your favorite JSON framework seri io.github.ouest-france bp-contract-generator - 1.0.0 + 1.0.2 ``` @@ -42,6 +42,9 @@ public class BlockProviderResource { // the block type .addType("bold").withVersion(1, 0, 0) + // set documentation + .withDocumentation("http://ww.google.fr") + // declare the endpoint url .withEndpoint("https://localhost/block-configurations", "GET", "pure") diff --git a/pom.xml b/pom.xml index 0b04d55..e96e655 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.ouest-france bp-contract-generator - 1.0.1-SANPASHOT + 1.0.2 UTF-8 diff --git a/src/main/java/sipa/blockprovider/BlockTypeBuilder.java b/src/main/java/sipa/blockprovider/BlockTypeBuilder.java index 2036c7f..3107588 100644 --- a/src/main/java/sipa/blockprovider/BlockTypeBuilder.java +++ b/src/main/java/sipa/blockprovider/BlockTypeBuilder.java @@ -70,6 +70,17 @@ public BlockTypeBuilder withVersion(final int major, final int minor, final int return this; } + /** + * Set the version of the block type. + * + * @param url external documentation url + * @return the block type builder + */ + public BlockTypeBuilder withDocumentation(final String url) { + this.blockConfiguration.setDocumentation(url); + return this; + } + /** * Specify the endpoint settings associated with the block type. * diff --git a/src/main/java/sipa/blockprovider/domain/BlockConfiguration.java b/src/main/java/sipa/blockprovider/domain/BlockConfiguration.java index 56ebede..dd400ff 100644 --- a/src/main/java/sipa/blockprovider/domain/BlockConfiguration.java +++ b/src/main/java/sipa/blockprovider/domain/BlockConfiguration.java @@ -9,6 +9,7 @@ public class BlockConfiguration { private String version; + private final Documentation documentation = new Documentation(); private final Endpoint endpoint = new Endpoint(); private final List