@@ -36,6 +36,8 @@ resources:
3636 name : "multiple documents with OpenAPI and SwaggerUI" ,
3737 yamlContent : `plugin: openapi
3838specFile: api.json
39+ config:
40+ externalBaseURL: "http://example.com"
3941resources:
4042 - path: /pets
4143 method: GET
@@ -58,6 +60,16 @@ config:
5860 if configs [0 ].SpecFile != "api.json" {
5961 t .Errorf ("Expected specFile 'api.json', got '%s'" , configs [0 ].SpecFile )
6062 }
63+
64+ // Verify plugin config content can be unmarshalled
65+ var plugin0Config map [string ]interface {}
66+ if err := configs [0 ].PluginConfig .Decode (& plugin0Config ); err != nil {
67+ t .Errorf ("Failed to unmarshal plugin config: %v" , err )
68+ }
69+
70+ if plugin0Config ["externalBaseURL" ] != "http://example.com" {
71+ t .Errorf ("Expected externalBaseURL 'http://example.com', got '%v'" , plugin0Config ["externalBaseURL" ])
72+ }
6173 if len (configs [0 ].Resources ) != 1 {
6274 t .Errorf ("Expected 1 resource in first config, got %d" , len (configs [0 ].Resources ))
6375 }
@@ -73,13 +85,13 @@ config:
7385 }
7486
7587 // Verify plugin config content can be unmarshaled
76- var pluginConfig map [string ]interface {}
77- if err := configs [1 ].PluginConfig .Decode (& pluginConfig ); err != nil {
88+ var plugin1Config map [string ]interface {}
89+ if err := configs [1 ].PluginConfig .Decode (& plugin1Config ); err != nil {
7890 t .Errorf ("Failed to unmarshal plugin config: %v" , err )
7991 }
8092
81- if specUrl , ok := pluginConfig ["specUrl" ].(string ); ! ok || specUrl != "http://localhost:8080/system/openapi" {
82- t .Errorf ("Expected specUrl 'http://localhost:8080/system/openapi', got '%v'" , pluginConfig ["specUrl" ])
93+ if specUrl , ok := plugin1Config ["specUrl" ].(string ); ! ok || specUrl != "http://localhost:8080/system/openapi" {
94+ t .Errorf ("Expected specUrl 'http://localhost:8080/system/openapi', got '%v'" , plugin1Config ["specUrl" ])
8395 }
8496 },
8597 },
0 commit comments