Skip to content

Commit

Permalink
chore: make use of studio sdk for reRun requestBody (#1295)
Browse files Browse the repository at this point in the history
This PR marks the `input` `overlay` and `targets` properties as required
the `RunRequestBody` properties so the component can be reused in the
`reRun` handler
  • Loading branch information
2ynn authored Feb 26, 2025
1 parent 5623660 commit 0c02773
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 43 deletions.
14 changes: 10 additions & 4 deletions internal/studio/oas_studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ paths:
$ref: "#/components/responses/HealthResponse"
/run:
get:
summary: Run
summary: Get Last RunResult
description: Get the output of the last run.
operationId: getRun
responses:
"200":
$ref: "#/components/responses/RunResponse"
post:
summary: Run
summary: Rerun generation
description: Regenerate the currently selected targets.
operationId: run
requestBody:
Expand All @@ -40,7 +40,7 @@ paths:
$ref: "#/components/responses/RunResponse"
/overlays/compare:
post:
summary: Generate an overlay from two yaml files
summary: Generate Overlay
description: Generate an overlay from two yaml files
operationId: generateOverlay
requestBody:
Expand Down Expand Up @@ -137,7 +137,13 @@ components:
type: object
additionalProperties:
$ref: "#/components/schemas/TargetSpecificInputs"
description: Map of target specific inputs keyed on target name
description: |
Map of target specific inputs keyed on target name
Only present if a target input is modified
required:
- overlay
- input
- targets
RunResponseData:
type: object
description: Map of target run summaries
Expand Down
10 changes: 5 additions & 5 deletions internal/studio/sdk/.speakeasy/gen.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/studio/sdk/.speakeasy/gen.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/studio/sdk/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions internal/studio/sdk/docs/models/components/runrequestbody.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/studio/sdk/docs/sdks/health/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions internal/studio/sdk/docs/sdks/run/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/studio/sdk/docs/sdks/sdk/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions internal/studio/sdk/models/components/runrequestbody.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/studio/sdk/run.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions internal/studio/sdk/sdk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions internal/studio/studioHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,7 @@ func (h *StudioHandlers) updateSourceAndTarget(r *http.Request) error {
Config string `json:"config"`
}

// Destructure the request body which is a json object with a single key "overlay" which is a string
var reqBody struct {
Overlay string `json:"overlay"`
Input string `json:"input"`
Targets map[string]components.TargetSpecificInputs `json:"targets"` // this is only present if a target input is modified
}
var reqBody components.RunRequestBody
err = json.NewDecoder(r.Body).Decode(&reqBody)
if err != nil {
return errors.ErrBadRequest.Wrap(fmt.Errorf("error decoding request body: %w", err))
Expand Down

0 comments on commit 0c02773

Please sign in to comment.