-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
144 lines (137 loc) · 4.84 KB
/
index.html
File metadata and controls
144 lines (137 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HCP Engagement API Documentation</title>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css" />
<link rel="icon" type="image/png" href="https://unpkg.com/swagger-ui-dist@5.9.0/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="https://unpkg.com/swagger-ui-dist@5.9.0/favicon-16x16.png" sizes="16x16" />
<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
.swagger-ui .topbar {
background-color: #2c3e50;
}
.swagger-ui .topbar .download-url-wrapper {
display: none;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js"></script>
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function() {
const ui = SwaggerUIBundle({
url: './openapi.yaml',
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
tryItOutEnabled: true,
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch', 'options'],
// Match Flask-RESTX functionality
defaultModelsExpandDepth: 2,
defaultModelExpandDepth: 2,
defaultModelRendering: 'example',
displayOperationId: false,
displayRequestDuration: true,
docExpansion: 'list',
filter: false,
maxDisplayedTags: -1,
operationsSorter: null,
showExtensions: false,
showCommonExtensions: false,
tagsSorter: 'alpha',
validatorUrl: null,
// Custom request/response handling to match local behavior
requestInterceptor: function(request) {
// Add custom headers that match Flask-RESTX behavior
if (request.url.includes('/auth/login')) {
// Don't add auth header for login
console.log('Login request:', request);
} else {
// Ensure Bearer token format
if (request.headers && request.headers.Authorization) {
if (!request.headers.Authorization.startsWith('Bearer ')) {
request.headers.Authorization = 'Bearer ' + request.headers.Authorization;
}
}
}
console.log('Request:', request);
return request;
},
responseInterceptor: function(response) {
console.log('Response:', response);
// Handle CORS and response formatting like Flask-RESTX
if (response.status === 200 && response.obj) {
// Format response to match Flask-RESTX structure
if (typeof response.obj === 'string') {
try {
response.obj = JSON.parse(response.obj);
} catch (e) {
// Keep as string if not JSON
}
}
}
return response;
},
// Enable all the features that Flask-RESTX Swagger has
showMutatedRequest: true,
tryItOutEnabled: true,
requestSnippetsEnabled: true,
requestSnippets: {
generators: {
"curl_bash": {
title: "cURL (bash)",
syntax: "bash"
},
"curl_powershell": {
title: "cURL (PowerShell)",
syntax: "powershell"
},
"curl_cmd": {
title: "cURL (CMD)",
syntax: "bash"
}
},
defaultExpanded: false,
languages: null
}
});
// Add custom demo credentials helper
setTimeout(function() {
const authSection = document.querySelector('.swagger-ui .auth-wrapper');
if (authSection) {
const demoNote = document.createElement('div');
demoNote.style.cssText = 'background: #e8f4fd; border: 1px solid #bee5eb; padding: 10px; margin: 10px 0; border-radius: 4px; font-size: 14px;';
demoNote.innerHTML = `
<strong>Demo Credentials:</strong><br>
• Provider: <code>demo_provider</code> / <code>demo123</code><br>
• Admin: <code>demo_admin</code> / <code>admin123</code><br>
<em>Use /auth/login first, then copy the access_token here with "Bearer " prefix</em>
`;
authSection.parentNode.insertBefore(demoNote, authSection);
}
}, 1000);
};
</script>
</body>
</html>