Skip to content

Commit

Permalink
Add labels to request response pair
Browse files Browse the repository at this point in the history
  • Loading branch information
tommysitu committed Jul 11, 2024
1 parent d0a5551 commit b133acb
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 49 deletions.
6 changes: 6 additions & 0 deletions core/handlers/v2/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@
},
"request-response-pair": {
"properties": {
"labels": {
"items": {
"type": "string"
},
"type": "array"
},
"request": {
"$ref": "#/definitions/request"
},
Expand Down
2 changes: 1 addition & 1 deletion core/handlers/v2/simulation_views.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewSimulationViewFromRequestBody(requestBody []byte) (SimulationViewV5, err

schemaVersion := jsonMap["meta"].(map[string]interface{})["schemaVersion"].(string)

if schemaVersion == "v5" || schemaVersion == "v5.1" || schemaVersion == "v5.2" {
if strings.HasPrefix(schemaVersion, "v5") {

err := ValidateSimulationSchemaFromFile(jsonMap, SimulationViewV5Schema)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions core/handlers/v2/simulation_views_v5.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type DataViewV5 struct {
}

type RequestMatcherResponsePairViewV5 struct {
Labels []string `json:"labels,omitempty"`
RequestMatcher RequestMatcherViewV5 `json:"request"`
Response ResponseDetailsViewV5 `json:"response"`
}
Expand Down
2 changes: 2 additions & 0 deletions core/models/request_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func getViewFromRequestFieldMatcher(matcher *RequestFieldMatchers) *v2.MatcherVi
}

type RequestMatcherResponsePair struct {
Labels []string
RequestMatcher RequestMatcher
Response ResponseDetails
}
Expand Down Expand Up @@ -229,6 +230,7 @@ func (this *RequestMatcherResponsePair) BuildView() v2.RequestMatcherResponsePai
}

return v2.RequestMatcherResponsePairViewV5{
Labels: this.Labels,
RequestMatcher: v2.RequestMatcherViewV5{
Path: path,
Method: method,
Expand Down
Loading

0 comments on commit b133acb

Please sign in to comment.