Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(blocktype): add documentation entry #1

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You simply need to generate the object and let your favorite JSON framework seri
<dependency>
<groupId>io.github.ouest-france</groupId>
<artifactId>bp-contract-generator</artifactId>
<version>1.0.0</version>
<version>1.0.2</version>
</dependency>
```

Expand All @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.ouest-france</groupId>
<artifactId>bp-contract-generator</artifactId>
<version>1.0.1-SANPASHOT</version>
<version>1.0.2</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/sipa/blockprovider/BlockTypeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/sipa/blockprovider/domain/BlockConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Template> templates = new ArrayList<>();

Expand All @@ -27,4 +28,14 @@ public void setVersion(final String version) {
public List<Template> getTemplates() {
return this.templates;
}

public Documentation getDocumentation() {
return this.documentation;
}

public void setDocumentation(final String url) { this.documentation.url = url; }

public class Documentation {
private String url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ void shouldSerializeOneBlockType() {
// 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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void shouldSerializeTwoBlockTypes() {
// the block type
.addType("bold").withVersion(1, 0, 0)

// set documentation
.withDocumentation("http://ww.google.fr")

// the input text
.addParameter("text")
.configurableAsString(null)
Expand Down
Loading