forked from HumanSignal/label-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: RND-74: Generate swagger.json (HumanSignal#5911)
When generating schema in CI, we need to access the latest swagger json Create a command: ``` make generate-swagger ``` that outputs `swagger.json` in the root directory **Additional changes to openapi schema** - a few more endpoints with extensions (projects, tasks, annotations, predictions) - example response --------- Co-authored-by: nik <[email protected]>
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,8 @@ class ProjectFilterSet(FilterSet): | |
name='get', | ||
decorator=swagger_auto_schema( | ||
tags=['Projects'], | ||
x_fern_sdk_group_name='projects', | ||
x_fern_sdk_method_name='list', | ||
operation_summary='List your projects', | ||
operation_description=""" | ||
Return a list of the projects that you've created. | ||
|
@@ -127,6 +129,8 @@ class ProjectFilterSet(FilterSet): | |
decorator=swagger_auto_schema( | ||
tags=['Projects'], | ||
operation_summary='Create new project', | ||
x_fern_sdk_group_name='projects', | ||
x_fern_sdk_method_name='create', | ||
operation_description=""" | ||
Create a project and set up the labeling interface in Label Studio using the API. | ||
|
@@ -189,14 +193,76 @@ def post(self, request, *args, **kwargs): | |
name='get', | ||
decorator=swagger_auto_schema( | ||
tags=['Projects'], | ||
x_fern_sdk_group_name='projects', | ||
x_fern_sdk_method_name='get', | ||
operation_summary='Get project by ID', | ||
operation_description='Retrieve information about a project by project ID.', | ||
responses={ | ||
'200': openapi.Response( | ||
description='Project information', | ||
schema=ProjectSerializer, | ||
examples={ | ||
'application/json': { | ||
'id': 1, | ||
'title': 'My project', | ||
'description': 'My first project', | ||
'label_config': '<View>[...]</View>', | ||
'expert_instruction': 'Label all cats', | ||
'show_instruction': True, | ||
'show_skip_button': True, | ||
'enable_empty_annotation': True, | ||
'show_annotation_history': True, | ||
'organization': 1, | ||
'color': '#FF0000', | ||
'maximum_annotations': 1, | ||
'is_published': True, | ||
'model_version': '1.0.0', | ||
'is_draft': False, | ||
'created_by': { | ||
'id': 1, | ||
'first_name': 'Jo', | ||
'last_name': 'Doe', | ||
'email': '[email protected]', | ||
}, | ||
'created_at': '2023-08-24T14:15:22Z', | ||
'min_annotations_to_start_training': 0, | ||
'start_training_on_annotation_update': True, | ||
'show_collab_predictions': True, | ||
'num_tasks_with_annotations': 10, | ||
'task_number': 100, | ||
'useful_annotation_number': 10, | ||
'ground_truth_number': 5, | ||
'skipped_annotations_number': 0, | ||
'total_annotations_number': 10, | ||
'total_predictions_number': 0, | ||
'sampling': 'Sequential sampling', | ||
'show_ground_truth_first': True, | ||
'show_overlap_first': True, | ||
'overlap_cohort_percentage': 100, | ||
'task_data_login': 'user', | ||
'task_data_password': 'secret', | ||
'control_weights': {}, | ||
'parsed_label_config': '{"tag": {...}}', | ||
'evaluate_predictions_automatically': False, | ||
'config_has_control_tags': True, | ||
'skip_queue': 'REQUEUE_FOR_ME', | ||
'reveal_preannotations_interactively': True, | ||
'pinned_at': '2023-08-24T14:15:22Z', | ||
'finished_task_number': 10, | ||
'queue_total': 10, | ||
'queue_done': 100, | ||
} | ||
}, | ||
) | ||
}, | ||
), | ||
) | ||
@method_decorator( | ||
name='delete', | ||
decorator=swagger_auto_schema( | ||
tags=['Projects'], | ||
x_fern_sdk_group_name='projects', | ||
x_fern_sdk_method_name='delete', | ||
operation_summary='Delete project', | ||
operation_description='Delete a project by specified project ID.', | ||
), | ||
|
@@ -205,6 +271,8 @@ def post(self, request, *args, **kwargs): | |
name='patch', | ||
decorator=swagger_auto_schema( | ||
tags=['Projects'], | ||
x_fern_sdk_group_name='projects', | ||
x_fern_sdk_method_name='update', | ||
operation_summary='Update project', | ||
operation_description='Update the project settings for a specific project.', | ||
request_body=ProjectSerializer, | ||
|
@@ -268,6 +336,8 @@ def put(self, request, *args, **kwargs): | |
decorator=swagger_auto_schema( | ||
tags=['Projects'], | ||
operation_summary='Get next task to label', | ||
x_fern_sdk_group_name='projects', | ||
x_fern_sdk_method_name='next_task', | ||
operation_description=""" | ||
Get the next task for labeling. If you enable Machine Learning in | ||
your project, the response might include a "predictions" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters