Skip to content

Commit

Permalink
Merge pull request #1261 from znsio/provider_config_change
Browse files Browse the repository at this point in the history
Add aliases for sources and provider keys
  • Loading branch information
joelrosario authored Aug 27, 2024
2 parents 18ccc65 + 9f6d06d commit 4050e0b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions core/src/main/kotlin/io/specmatic/core/SpecmaticConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ data class WorkflowConfiguration(
)

data class SpecmaticConfig(
@field:JsonAlias("contract_repositories")
val sources: List<Source> = emptyList(),
val auth: Auth? = null,
val pipeline: Pipeline? = null,
Expand Down Expand Up @@ -165,6 +166,7 @@ data class Environment(
enum class SourceProvider { git, filesystem, web }

data class Source(
@field:JsonAlias("type")
val provider: SourceProvider = SourceProvider.filesystem,
val repository: String? = null,
val branch: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ internal class SpecmaticConfigKtTest {
"./src/test/resources/specmaticConfigFiles/specmatic_alias.json",
)
@ParameterizedTest
fun `parse specmatic config file with aliases provides and consumes`(configFile: String) {
fun `parse specmatic config file with aliases`(configFile: String) {
val config: SpecmaticConfig = loadSpecmaticConfig(configFile)

assertThat(config.sources).isNotEmpty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sources": [
"contract_repositories": [
{
"provider": "git",
"type": "git",
"repository": "https://contracts",
"provides": [
"com/petstore/1.yaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sources:
- provider: git
contract_repositories:
- type: git
repository: https://contracts
provides:
- com/petstore/1.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sources:
- provider: git
contract_repositories:
- type: git
repository: https://contracts
provides:
- com/petstore/1.yaml
Expand Down

0 comments on commit 4050e0b

Please sign in to comment.