Skip to content

Commit 7c3849f

Browse files
committed
deploy(arazzo): send associated openapi sources during workflow deployments
This commit adapts the workflow deploy API call to send both the workflow definition AND it's list of “references” (the list of openapi dependencies from the `sourceDescriptions` of arazzo workflows)
1 parent e05330e commit 7c3849f

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

src/api/models.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ export interface DiffItem {
8282

8383
export interface WorkflowVersionRequest {
8484
definition: string // workflowDefinition
85+
// List of API references attached to the
86+
// workflow (source descriptions in Arazzo
87+
// vocabulary)
88+
references?: Reference[]
8589
}
8690

8791
export interface WorkflowVersionResponse {

src/core/workflow-deploy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ export class WorkflowDeploy {
5050
): Promise<WorkflowVersionResponse | undefined> {
5151
let version: WorkflowVersionResponse | undefined
5252

53-
const request: WorkflowVersionRequest = {
54-
definition: workflowDefinition.rawDefinition,
55-
}
53+
const [definition, references] = await workflowDefinition.extractDefinition()
54+
55+
const request: WorkflowVersionRequest = {definition, references}
5656

5757
// eslint-disable-next-line prefer-const
5858
version = await this.createWorkflowVersion(mcpServer, request, token)

test/commands/deploy.test.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {expect} from 'chai'
33
import nock from 'nock'
44
import {stub} from 'sinon'
55

6+
import {API} from '../../src/definition'
7+
68
nock.disableNetConnect()
79

810
process.env.BUMP_TOKEN = process.env.BUMP_TOKEN || 'BAR'
@@ -110,7 +112,7 @@ describe('deploy subcommand', () => {
110112
})
111113

112114
describe('Successful runs with MCP server', () => {
113-
it('sends new workflow definition to Bump', async () => {
115+
it('sends new workflow definition (flower) to Bump', async () => {
114116
nock('https://bump.sh').post('/api/v1/mcp_servers/crab/deploy').reply(201, {})
115117

116118
const {stderr, stdout} = await runCommand(
@@ -123,6 +125,33 @@ describe('deploy subcommand', () => {
123125
)
124126
})
125127

128+
it('sends new workflow definition with openapi sources (arazzo) to Bump', async () => {
129+
const [definition, references] = await (
130+
await API.load('examples/valid/arazzo/wikimedia.json')
131+
).extractDefinition()
132+
nock('https://bump.sh')
133+
.post('/api/v1/mcp_servers/crab/deploy', (body) => {
134+
const {content: expectedContent, location: expectedLocation, name: expectedName} = references[0]
135+
const {content: actualContent, location: actualLocation, name: actualName} = body.references[0]
136+
return (
137+
body.definition === definition &&
138+
expectedContent === actualContent &&
139+
expectedName === actualName &&
140+
expectedLocation === actualLocation
141+
)
142+
})
143+
.reply(201, {})
144+
145+
const {stderr, stdout} = await runCommand(
146+
['deploy', 'examples/valid/arazzo/wikimedia.json', '--mcp-server', 'crab'].join(' '),
147+
)
148+
149+
expect(stderr).to.contain("Let's deploy on Bump.sh... done\n")
150+
expect(stdout).to.contain(
151+
'Your crab MCP server...has received a new workflow definition which will soon be ready.',
152+
)
153+
})
154+
126155
it('sends unchanged workflow definition to Bump', async () => {
127156
nock('https://bump.sh').post('/api/v1/mcp_servers/crab/deploy').reply(204)
128157

0 commit comments

Comments
 (0)