Skip to content

Commit

Permalink
fix(schemas): extract object schemas (#45)
Browse files Browse the repository at this point in the history
Improve code generation
  • Loading branch information
rbioteau authored Jul 7, 2022
1 parent 80d6d01 commit 4fd2204
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 91 deletions.
19 changes: 1 addition & 18 deletions openapi/components/schemas/Contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,7 @@ properties:
constraints:
type: array
items:
type: object
properties:
name:
description: "constraint name"
type: string
expression:
description: "constraint expression"
type: string
explanation:
description: "constraint explanation"
type: string
inputNames:
type: array
items:
type: string
constraintType:
description: "constraint type (ex: MANDATORY)"
type: string
$ref: './ContractConstraint.yaml'
inputs:
type: array
items:
Expand Down
15 changes: 15 additions & 0 deletions openapi/components/schemas/ContractConstraint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type: object
properties:
name:
description: "constraint name"
type: string
expression:
description: "constraint expression"
type: string
explanation:
description: "constraint explanation"
type: string
inputNames:
type: array
items:
type: string
3 changes: 1 addition & 2 deletions openapi/components/schemas/ContractInput.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ properties:
description: "true if input contains multiple values"
type: string
type:
description: "input type"
type: string
$ref: "./ContractInputType.yaml"
inputs:
type: array
items:
Expand Down
14 changes: 14 additions & 0 deletions openapi/components/schemas/ContractInputType.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type: string
description: "the contract input type (string)"
enum:
- TEXT
- BOOLEAN
- DATE
- INTEGER
- DECIMAL
- BYTE_ARRAY
- FILE
- LONG
- LOCALDATE
- LOCALDATETIME
- OFFSETDATETIME
44 changes: 3 additions & 41 deletions openapi/components/schemas/DesignProcessDefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@ properties:
description: "The process parameter definitions"
type: array
items:
type: object
properties:
type:
description: "the parameter type"
type: string
description:
description: "the parameter description"
type: string
name:
description: "the parameter name"
type: string
$ref: './DesignProcessDefinitionParamater.yaml'
actorsList:
description: "The list of process actor definitions"
type: array
Expand All @@ -43,37 +33,9 @@ properties:
$ref: './Expression.yaml'
contract:
description: "the process instantiation contract"
type: object
properties:
inputs:
description: "Lists the inputs of the container."
type: array
items:
$ref: './InputDefinition.yaml'
constraints:
description: "Lists the validation rules of the contract."
type: array
items:
type: object
description: "A constraint when executing the task instance"
properties:
name:
type: string
expression:
type: string
explanation:
type: string
inputNames:
type: array
items:
type: string
$ref: './Contract.yaml'
context:
description: "The process definition expressions"
type: array
items:
type: object
properties:
key:
type: string
expression:
$ref: './Expression.yaml'
$ref: './DesignProcessDefinitionContext.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: object
description: "The process definition expressions"
properties:
key:
type: string
expression:
$ref: './Expression.yaml'
11 changes: 11 additions & 0 deletions openapi/components/schemas/DesignProcessDefinitionParamater.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type: object
properties:
type:
description: "the parameter type"
type: string
description:
description: "the parameter description"
type: string
name:
description: "the parameter name"
type: string
14 changes: 0 additions & 14 deletions openapi/components/schemas/InputDefinition.yaml

This file was deleted.

7 changes: 1 addition & 6 deletions openapi/components/schemas/ProcessInstanceCreateRequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ properties:
description: process variables initial values
type: array
items:
type: object
additionalProperties: true
properties:
name:
description: variable name
type: string
$ref: './ProcessVariable.yaml'
example:
processDefinitionId: "5777042023671752656"
variables:
Expand Down
7 changes: 7 additions & 0 deletions openapi/components/schemas/ProcessVariable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: object
additionalProperties:
type: object
properties:
name:
description: variable name
type: string
9 changes: 9 additions & 0 deletions openapi/components/schemas/UpdateTaskByIdRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: object
additionalProperties: true
properties:
state:
description: state of the Task (completed)
type: string
displayName:
description: display name of the Task
type: string
2 changes: 1 addition & 1 deletion openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
license:
name: GPL-v2.0
url: 'http://www.gnu.org/licenses/gpl-2.0.txt'
version: 0.0.7
version: 0.0.9
title: Bonita HTTP API
description:
# Ignore IDE warnings
Expand Down
10 changes: 1 addition & 9 deletions openapi/paths/API@bpm@task@{id}.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,7 @@ put:
content:
application/json:
schema:
type: object
additionalProperties: true
properties:
state:
description: state of the Task (completed)
type: string
displayName:
description: display name of the Task
type: string
$ref: '../components/schemas/UpdateTaskByIdRequest.yaml'
example:
state: "completed"
description: 'Task fields to update (forbidden fields are : `caseId`, `processId`, `name`, `executedBy`, `type`, `id`, `reached_state_date`, `last_update_date`)'
Expand Down

0 comments on commit 4fd2204

Please sign in to comment.