Skip to content

Commit

Permalink
Adds better backwards compatibility for removal of documentation sect…
Browse files Browse the repository at this point in the history
…ions.
  • Loading branch information
simonbrowndotje committed Mar 11, 2023
1 parent fe12158 commit 864f5de
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ subprojects { proj ->

description = 'Structurizr'
group = 'com.structurizr'
version = '1.22.2'
version = '1.22.3'

repositories {
mavenCentral()
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.22.3 (11th March 2023)

- Adds better backwards compatibility for removal of documentation sections.

## 1.22.2 (10th March 2023)

- Updates Jackson library dependency.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package com.structurizr.api;

import com.structurizr.Workspace;
import com.structurizr.documentation.Format;
import com.structurizr.documentation.Section;
import com.structurizr.model.Location;
import com.structurizr.util.WorkspaceUtils;
import org.junit.jupiter.api.Test;

import java.io.File;

import static org.junit.jupiter.api.Assertions.assertEquals;

class BackwardsCompatibilityTests {

private static final File PATH_TO_WORKSPACE_FILES = new File("test/integration/backwardsCompatibility");
Expand All @@ -16,4 +22,12 @@ void test() throws Exception {
}
}

@Test
void documentation() throws Exception {
Workspace workspace = new Workspace("Name", "Description");
workspace.getDocumentation().addSection(new Section(Format.Markdown, "## Heading 1"));

assertEquals("{\"id\":0,\"name\":\"Name\",\"description\":\"Description\",\"configuration\":{},\"model\":{},\"documentation\":{\"sections\":[{\"content\":\"## Heading 1\",\"format\":\"Markdown\",\"order\":1,\"title\":\"\"}]},\"views\":{\"configuration\":{\"branding\":{},\"styles\":{},\"terminology\":{}}}}", WorkspaceUtils.toJson(workspace, false));
}

}
12 changes: 12 additions & 0 deletions structurizr-core/src/com/structurizr/documentation/Section.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.structurizr.documentation;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonInclude;

/**
* A documentation section.
*/
Expand All @@ -16,6 +19,15 @@ public Section(Format format, String content) {
setContent(content);
}

/**
* This method is retained for backwards compatibility.
*/
@JsonGetter
@JsonInclude(JsonInclude.Include.ALWAYS)
public String getTitle() {
return "";
}

/**
* Gets the filename of this section.
*
Expand Down

0 comments on commit 864f5de

Please sign in to comment.