Skip to content

Commit 5689376

Browse files
committed
sepcs
1 parent 3e46c4e commit 5689376

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

specs/audit/deployment-history-api-spec.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ openapi: "3.0.3"
22
info:
33
version: 1.0.0
44
title: Helm App Deployment History
5+
description: API for retrieving deployment history information for Helm applications
6+
7+
servers:
8+
- url: /orchestrator
9+
description: Devtron Orchestrator API Server
10+
511
paths:
612
/orchestrator/application/deployment-history:
713
get:

specs/audit/deployment-history.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ openapi: "3.0.0"
22
info:
33
version: 1.0.0
44
title: Deployment History API
5+
description: API for retrieving deployment history and component details
6+
7+
servers:
8+
- url: /orchestrator
9+
description: Devtron Orchestrator API Server
10+
511
paths:
612
/orchestrator/app/history/deployed-component/detail/{appId}/{pipelineId}/{id}:
713
get:

specs/ent-only/panels_api-spec.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,29 @@ paths:
116116
'204':
117117
description: Panel deleted successfully
118118

119+
/orchestrator/clusters/{cluster_id}/panel:
120+
post:
121+
summary: Create a new panel for a specific cluster (plural clusters path)
122+
parameters:
123+
- in: path
124+
name: cluster_id
125+
required: true
126+
schema:
127+
type: string
128+
requestBody:
129+
required: true
130+
content:
131+
application/json:
132+
schema:
133+
$ref: '#/components/schemas/Panel'
134+
responses:
135+
'201':
136+
description: Panel created successfully
137+
content:
138+
application/json:
139+
schema:
140+
$ref: '#/components/schemas/Panel'
141+
119142
components:
120143
schemas:
121144
Panel:

tests/api-spec-validation/framework.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (v *APISpecValidator) validateEndpoint(path, method string, operation *open
186186
}
187187

188188
// Test the endpoint
189-
if err := v.testEndpoint(&result, path, method, operation); err != nil {
189+
if err := v.testEndpoint(&result, path, method, operation, spec); err != nil {
190190
result.Issues = append(result.Issues, ValidationIssue{
191191
Type: "REQUEST_ERROR",
192192
Message: err.Error(),
@@ -219,13 +219,30 @@ func (v *APISpecValidator) validateEndpoint(path, method string, operation *open
219219
}
220220

221221
// testEndpoint makes an actual HTTP request to test the endpoint
222-
func (v *APISpecValidator) testEndpoint(result *ValidationResult, path, method string, operation *openapi3.Operation) error {
222+
func (v *APISpecValidator) testEndpoint(result *ValidationResult, path, method string, operation *openapi3.Operation, spec *openapi3.T) error {
223223
// Process path parameters and build the full URL
224224
processedPath, err := v.processPathParameters(path, operation)
225225
if err != nil {
226226
return fmt.Errorf("failed to process path parameters: %w", err)
227227
}
228-
url := v.serverURL + processedPath
228+
229+
// Build the full URL considering OpenAPI spec server URLs
230+
baseURL := v.serverURL
231+
if spec.Servers != nil && len(spec.Servers) > 0 {
232+
// Use the first server URL from the spec and combine with base server URL
233+
specServerURL := spec.Servers[0].URL
234+
if specServerURL != "" {
235+
// If spec server URL is relative (starts with /), append to base URL
236+
if strings.HasPrefix(specServerURL, "/") {
237+
baseURL = v.serverURL + specServerURL
238+
} else {
239+
// If spec server URL is absolute, use it as is (but this is rare for our case)
240+
baseURL = specServerURL
241+
}
242+
}
243+
}
244+
245+
url := baseURL + processedPath
229246

230247
// Create request with proper body
231248
var req *http.Request

0 commit comments

Comments
 (0)