Skip to content

Commit

Permalink
api - change deletion endpoint to param based
Browse files Browse the repository at this point in the history
Request body seems to not be couraged by
flask/connexion generator framework.
  • Loading branch information
cherusk committed Nov 16, 2023
1 parent 4dd87cd commit 471b44f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 56 deletions.
4 changes: 1 addition & 3 deletions api/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@
)


def breeders_delete(content): # noqa: E501
def breeders_name_delete(breeder_name): # noqa: E501
"""breeders_delete
Purge a breeder # noqa: E501
"""

breeder_name = content.get('name')

# cleanup dag definition config file
filename = f"{DAG_DIR}/root_dag.py"

Expand Down
100 changes: 50 additions & 50 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,41 @@ paths:
properties:
message:
type: string
delete:
description: Purge a breeder
put:
description: Update a breeder configuration
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
properties:
name:
type: string
responses:
'204':
description: Successfully updated the running breeder
'400':
description: Invalid request
content:
application/json:
schema:
type: object
properties:
message:
type: string

/breeders/{name}:
delete:
description: Purge a breeder
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
'200':
description: Successfully purged the breeder
Expand All @@ -99,22 +126,28 @@ paths:
properties:
message:
type: string
put:
description: Update a breeder configuration
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
properties:
name:
type: string
get:
description: Obtain information about breeder from its name
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
'204':
description: Successfully updated the running breeder
'200':
description: Successfully returned list of configured breeders
content:
application/json:
schema:
type: array
items:
type: object
required:
- name
properties:
name:
type: string
'400':
description: Invalid request
content:
Expand All @@ -124,36 +157,3 @@ paths:
properties:
message:
type: string

/breeders/{name}:
get:
description: Obtain information about breeder from its name
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
'200':
description: Successfully returned list of configured breeders
content:
application/json:
schema:
type: array
items:
type: object
required:
- name
properties:
name:
type: string
'400':
description: Invalid request
content:
application/json:
schema:
type: object
properties:
message:
type: string
4 changes: 1 addition & 3 deletions cli/maskfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ set -eEux
__api_version="${api_version:-v0}"

curl --request DELETE \
-H 'Content-Type: application/json' \
--data "{ \"name\": \"${name}\" }" \
"http://${hostname}:${port}/${__api_version}/breeders"
"http://${hostname}:${port}/${__api_version}/breeders/${name}"
~~~

### breeder update
Expand Down

0 comments on commit 471b44f

Please sign in to comment.