Skip to content

Commit

Permalink
feat: update openapi with GET /scenario-iterations/{iterationId}/vali…
Browse files Browse the repository at this point in the history
…date
  • Loading branch information
Vivien-marble committed Aug 21, 2023
1 parent c8aef80 commit 42be5dd
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 10 deletions.
54 changes: 47 additions & 7 deletions packages/marble-api/scripts/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,41 @@ paths:
type: object
required:
- iteration
- scenario_validation
properties:
iteration:
$ref: '#/components/schemas/ScenarioIterationWithBody'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
/scenario-iterations/{scenarioIterationId}/validate:
get:
tags:
- Scenario Iterations
summary: Validate a scenario iteration by id
operationId: validateScenarioIteration
security:
- bearerAuth: []
parameters:
- name: scenarioIterationId
description: ID of the scenario iteration
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The scenario iteration corresponding to the provided `scenarioIterationId`
content:
application/json:
schema:
type: object
required:
- scenario_validation
properties:
scenario_validation:
$ref: '#/components/schemas/ScenarioValidationDto'
'401':
Expand Down Expand Up @@ -823,12 +854,9 @@ paths:
type: object
required:
- rule
- scenario_validation
properties:
rule:
$ref: '#/components/schemas/ScenarioIterationRuleDto'
scenario_validation:
$ref: '#/components/schemas/ScenarioValidationDto'
'401':
$ref: '#/components/responses/401'
'403':
Expand Down Expand Up @@ -2051,12 +2079,24 @@ components:
type: object
required:
- return_value
- evaluation_error
- errors
properties:
return_value:
$ref: '#/components/schemas/ConstantDto'
evaluation_error:
type: string
errors:
type: object
required:
- code
- message
properties:
code:
type: string
enum:
- UNEXPECTED_ERROR
- UNKNOWN_FUNCTION
- WRONG_NUMBER_OF_ARGUMENTS
message:
type: string
children:
type: array
items:
Expand Down
29 changes: 26 additions & 3 deletions packages/marble-api/src/generated/marble-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ export type UpdateScenarioIterationBody = {
};
export type NodeEvaluationDto = {
return_value: ConstantDto;
evaluation_error: string;
errors: {
code: "UNEXPECTED_ERROR" | "UNKNOWN_FUNCTION" | "WRONG_NUMBER_OF_ARGUMENTS";
message: string;
};
children?: NodeEvaluationDto[];
named_children?: {
[key: string]: NodeEvaluationDto;
Expand Down Expand Up @@ -710,7 +713,6 @@ export function updateScenarioIteration(scenarioIterationId: string, updateScena
status: 200;
data: {
iteration: ScenarioIterationWithBody;
scenario_validation: ScenarioValidationDto;
};
} | {
status: 401;
Expand All @@ -727,6 +729,28 @@ export function updateScenarioIteration(scenarioIterationId: string, updateScena
body: updateScenarioIterationBody
})));
}
/**
* Validate a scenario iteration by id
*/
export function validateScenarioIteration(scenarioIterationId: string, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: {
scenario_validation: ScenarioValidationDto;
};
} | {
status: 401;
data: string;
} | {
status: 403;
data: string;
} | {
status: 404;
data: string;
}>(`/scenario-iterations/${encodeURIComponent(scenarioIterationId)}/validate`, {
...opts
}));
}
/**
* List rules
*/
Expand Down Expand Up @@ -805,7 +829,6 @@ export function updateScenarioIterationRule(ruleId: string, updateScenarioIterat
status: 200;
data: {
rule: ScenarioIterationRuleDto;
scenario_validation: ScenarioValidationDto;
};
} | {
status: 401;
Expand Down

0 comments on commit 42be5dd

Please sign in to comment.