Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,26 @@ Please note that first will be checked `per second` call limit then `per minute`

Info about rate limiting availability at some instance can be found over next API endpoint: https://apisandbox.openbankproject.com/obp/v3.1.0/rate-limiting. The response we are interested in looks like this:

### OpenAPI Server Configuration

The OpenAPI documentation endpoint (`/resource-docs/VERSION/openapi`) now dynamically uses the configured `hostname` property instead of hardcoded values.

The `hostname` property is required for the API to start and must contain the full URL:

```properties
# This property is required and must contain the full URL
hostname=https://your-api-server.com
```

If not configured, the application will fail to start with error "OBP-00001: Hostname not specified".

The OpenAPI documentation will show a single server entry using the configured hostname:
```json
"servers": [
{"url": "https://your-api-server.com", "description": "Back-end server"}
]
```

```JSON
{
"enabled": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ object OpenAPI31JSONFactory extends MdcLoggable {
def createOpenAPI31Json(
resourceDocs: List[ResourceDocJson],
requestedApiVersion: String,
hostname: String = "api.openbankproject.com"
hostname: String
): OpenAPI31Json = {

val timestamp = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
Expand Down Expand Up @@ -380,12 +380,8 @@ object OpenAPI31JSONFactory extends MdcLoggable {
// Create Servers
val servers = List(
ServerJson(
url = s"https://$hostname",
description = Some("Production server")
),
ServerJson(
url = "https://apisandbox.openbankproject.com",
description = Some("Sandbox server")
url = hostname,
description = Some("Back-end server")
)
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package code.api.ResourceDocs1_4_0

import code.api.Constant.{GET_DYNAMIC_RESOURCE_DOCS_TTL, GET_STATIC_RESOURCE_DOCS_TTL, PARAM_LOCALE}
import code.api.Constant.{GET_DYNAMIC_RESOURCE_DOCS_TTL, GET_STATIC_RESOURCE_DOCS_TTL, PARAM_LOCALE, HostName}
import code.api.OBPRestHelper
import code.api.cache.Caching
import code.api.util.APIUtil._
Expand Down Expand Up @@ -828,7 +828,8 @@ trait ResourceDocsAPIMethods extends MdcLoggable with APIMethods220 with APIMeth

private def convertResourceDocsToOpenAPI31JvalueAndSetCache(cacheKey: String, requestedApiVersionString: String, resourceDocsJson: List[JSONFactory1_4_0.ResourceDocJson]) : JValue = {
logger.debug(s"Generating OpenAPI 3.1-convertResourceDocsToOpenAPI31JvalueAndSetCache requestedApiVersion is $requestedApiVersionString")
val openApiDoc = code.api.ResourceDocs1_4_0.OpenAPI31JSONFactory.createOpenAPI31Json(resourceDocsJson, requestedApiVersionString)
val hostname = HostName
val openApiDoc = code.api.ResourceDocs1_4_0.OpenAPI31JSONFactory.createOpenAPI31Json(resourceDocsJson, requestedApiVersionString, hostname)
val openApiJValue = code.api.ResourceDocs1_4_0.OpenAPI31JSONFactory.OpenAPI31JsonFormats.toJValue(openApiDoc)

val jsonString = json.compactRender(openApiJValue)
Expand Down