Skip to content

Commit 9eb7265

Browse files
committed
showing version url in input box
1 parent 5db4848 commit 9eb7265

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/components/Preview.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,17 @@ const roleForm = reactive({})
7474
7575
const setOperationDetails = (id: string, version: string): void => {
7676
const operation = getOperationDetails(version, id, resourceDocs)
77-
url.value = operation?.specified_url
77+
// Replace the version in the URL with the current viewing version
78+
// This ensures users test against the version they're viewing (e.g., v6.0.0)
79+
// even if the endpoint was originally defined in an earlier version (e.g., v3.1.0)
80+
if (operation?.specified_url) {
81+
// Extract version without OBP prefix for URL replacement (e.g., "OBPv6.0.0" -> "v6.0.0")
82+
const versionWithoutPrefix = version.replace('OBP', '')
83+
// Replace /obp/vX.X.X/ with the current version
84+
url.value = operation.specified_url.replace(/\/obp\/v\d+\.\d+\.\d+\//, `/obp/${versionWithoutPrefix}/`)
85+
} else {
86+
url.value = operation?.specified_url
87+
}
7888
method.value = operation?.request_verb
7989
exampleRequestBody.value = operation.example_request_body
8090
requiredRoles.value = operation.roles || []

0 commit comments

Comments
 (0)