Skip to content

Commit b0bce34

Browse files
authored
Merge pull request #21 from sonatype-nexus-community/fix/TaskTemplateXO-for-update
fix: Make `type` optional for `PUT /v1/tasks/{taskId}`
2 parents eb99f01 + 7c94b0f commit b0bce34

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

spec/openapi.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14692,7 +14692,37 @@ paths:
1469214692
content:
1469314693
application/json:
1469414694
schema:
14695-
$ref: '#/components/schemas/TaskTemplateXO'
14695+
properties:
14696+
alertEmail:
14697+
description: e-mail for task notifications.
14698+
type: string
14699+
enabled:
14700+
description: Indicates if the task would be enabled.
14701+
type: boolean
14702+
frequency:
14703+
$ref: '#/components/schemas/FrequencyXO'
14704+
name:
14705+
description: The name of the task template.
14706+
type: string
14707+
notificationCondition:
14708+
description: Condition required to notify a task execution.
14709+
enum:
14710+
- FAILURE
14711+
- SUCCESS_FAILURE
14712+
type: string
14713+
properties:
14714+
additionalProperties:
14715+
type: string
14716+
description: Additional properties for the task
14717+
type: object
14718+
type:
14719+
description: The type of task to be created.
14720+
type: string
14721+
required:
14722+
- enabled
14723+
- frequency
14724+
- name
14725+
- notificationCondition
1469614726
required: false
1469714727
responses:
1469814728
default:

update-spec.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,5 +448,46 @@ def parse_version_from_server_header(header: str) -> str:
448448
'schema']['$ref'] = '#/components/schemas/SimpleApiGroupDeployRepository'
449449
print(' Done')
450450

451+
print('Injecting requestBody schema for PUT /v1/tasks/{taskId}...')
452+
json_spec['paths']['/v1/tasks/{taskId}']['put']['requestBody']['content'][('application''/json')]['schema'] = {
453+
'properties': {
454+
'alertEmail': {
455+
'description': 'e-mail for task notifications.',
456+
'type': 'string'
457+
},
458+
'enabled': {
459+
'description': 'Indicates if the task would be enabled.',
460+
'type': 'boolean'
461+
},
462+
'frequency': {
463+
'$ref': '#/components/schemas/FrequencyXO'
464+
},
465+
'name': {
466+
'description': 'The name of the task template.',
467+
'type': 'string'
468+
},
469+
'notificationCondition': {
470+
'description': 'Condition required to notify a task execution.',
471+
'enum': ['FAILURE', 'SUCCESS_FAILURE'],
472+
'type': 'string'
473+
},
474+
'properties': {
475+
'additionalProperties': {
476+
'type': 'string'
477+
},
478+
'description': 'Additional properties for the task',
479+
'type': 'object'
480+
},
481+
'type': {
482+
'description': 'The type of task to be created.',
483+
'type': 'string'
484+
}
485+
},
486+
'required': [
487+
'enabled', 'frequency', 'name', 'notificationCondition'
488+
]
489+
}
490+
print(' Done')
491+
451492
with open('./spec/openapi.yaml', 'w') as output_yaml_specfile:
452493
output_yaml_specfile.write(yaml_dump(json_spec))

0 commit comments

Comments
 (0)