theGardener icon indicating copy to clipboard operation
theGardener copied to clipboard

[OpenAPI] Cannot use variable when declaring openApiUrl

Open loriepisicchio opened this issue 4 years ago • 0 comments

Actual behavior When trying to including some OpenAPI in a page with the following settings:

```thegardener
{
  "openApi" : 
     {
        "openApiUrl": "${swagger.url}",
        "openApiType": "model",
        "ref": "#/definitions/ShoppingOffer",
        "deep": 1
     }
}
```

I get the following exception server side :

java.lang.IllegalArgumentException: Invalid URL ${swagger.url}
	at play.api.libs.ws.ahc.StandaloneAhcWSClient.validate(StandaloneAhcWSClient.scala:101)
	at play.api.libs.ws.ahc.StandaloneAhcWSClient.url(StandaloneAhcWSClient.scala:57)
	at play.api.libs.ws.ahc.AhcWSClient.url(AhcWSClient.scala:37)
	at services.clients.OpenApiClient.getOpenApiJsonString(OpenApiClient.scala:30)
	at services.clients.OpenApiClient.$anonfun$getOpenApiDescriptor$1(OpenApiClient.scala:23)
	at scala.Option.map(Option.scala:163)
	at services.clients.OpenApiClient.getOpenApiDescriptor(OpenApiClient.scala:22)
	at services.PageService.$anonfun$processPageFragments$1(PageService.scala:335)
...

It seems that the parsing doesn't try to inject variable value and uses string literal "${swagger.url}"

Expected behavior I would like to be able to use a variable in the settings definition.

loriepisicchio avatar Feb 28 '20 13:02 loriepisicchio