-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove groupId and systemId from application data and introduce stati…
…c metadata for naming and grouping of components
- Loading branch information
Showing
12 changed files
with
133 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../buildSrc/src/main/kotlin/documentation/generators/asciidoc/EndpointsOverviewGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ld/buildSrc/src/main/kotlin/documentation/generators/plantuml/AbstractDiagramGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...c/src/main/kotlin/documentation/generators/plantuml/ApplicationContextDiagramGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
.build/buildSrc/src/main/kotlin/documentation/generators/translations.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
.build/buildSrc/src/main/kotlin/documentation/model/metadata.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package documentation.model | ||
|
||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import org.springframework.core.io.ClassPathResource | ||
import kotlin.text.Charsets.UTF_8 | ||
|
||
private val metadata = Metadata.load() | ||
|
||
data class Metadata( | ||
val components: List<ComponentMetadata>, | ||
val groups: List<GroupMetadata>, | ||
val systems: List<SystemMetadata>, | ||
) { | ||
companion object { | ||
fun load(): Metadata { | ||
val resource = ClassPathResource("/metadata.json") | ||
val json = resource.getContentAsString(UTF_8) | ||
return loadingObjectMapper.readValue(json) | ||
} | ||
} | ||
} | ||
|
||
data class ComponentMetadata( | ||
val id: String, | ||
val name: String, | ||
val groupId: String?, | ||
val systemId: String?, | ||
) | ||
|
||
data class GroupMetadata( | ||
val id: String, | ||
val name: String, | ||
) | ||
|
||
data class SystemMetadata( | ||
val id: String, | ||
val name: String, | ||
) | ||
|
||
fun componentName(id: String): String = | ||
metadata.components.firstOrNull { it.id == id }?.name ?: id | ||
|
||
fun groupName(id: String): String = | ||
metadata.groups.firstOrNull { it.id == id }?.name ?: id | ||
|
||
fun systemName(id: String): String = | ||
metadata.systems.firstOrNull { it.id == id }?.name ?: id | ||
|
||
fun groupIdOfComponent(componentId: String): String? = | ||
metadata.components.firstOrNull { it.id == componentId }?.groupId | ||
|
||
fun systemIdOfComponent(componentId: String): String? = | ||
metadata.components.firstOrNull { it.id == componentId }?.systemId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
.build/buildSrc/src/main/resources/i18n/components.properties
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"components": [ | ||
{ | ||
"id": "frontend", | ||
"name": "Frontend", | ||
"groupId": "application", | ||
"systemId": "platform" | ||
}, | ||
{ | ||
"id": "backend-service-1", | ||
"name": "Backend Service #1", | ||
"groupId": "application", | ||
"systemId": "platform" | ||
}, | ||
{ | ||
"id": "backend-service-1-database", | ||
"name": "database", | ||
"groupId": "application", | ||
"systemId": "platform" | ||
}, | ||
{ | ||
"id": "backend-service-2", | ||
"name": "Backend Service #2", | ||
"groupId": "application", | ||
"systemId": "platform" | ||
}, | ||
{ | ||
"id": "external-service-1", | ||
"name": "External Service #1", | ||
"systemId": "platform" | ||
}, | ||
{ | ||
"id": "external-service-2", | ||
"name": "External Service #2", | ||
"systemId": "platform" | ||
}, | ||
{ | ||
"id": "external-service-3", | ||
"name": "External Service #3", | ||
"systemId": "other-project" | ||
} | ||
], | ||
"groups": [ | ||
{ | ||
"id": "application", | ||
"name": "Application" | ||
} | ||
], | ||
"systems": [ | ||
{ | ||
"id": "platform", | ||
"name": "Platform" | ||
}, | ||
{ | ||
"id": "other-project", | ||
"name": "Other Project" | ||
} | ||
] | ||
} |