From 1171c107601b221ce5a1e1f23b1f4c0a340b9afd Mon Sep 17 00:00:00 2001 From: Murilo Geraldini Date: Thu, 6 Feb 2025 14:36:06 -0300 Subject: [PATCH] fix(docs): update field names and query params - Added query params to tree/{commit-hash}/summary - Updated field names of issue/{commit-hash}/tests - Updated field names of issue/{commit-hash}/builds Part of #86 --- .../kernelCI_app/typeModels/issueDetails.py | 38 +++--- .../kernelCI_app/typeModels/treeDetails.py | 2 +- .../views/treeDetailsSummaryView.py | 4 +- backend/requests/issue-details-tests-get.sh | 4 +- backend/schema.yml | 123 +++++++++--------- 5 files changed, 87 insertions(+), 84 deletions(-) diff --git a/backend/kernelCI_app/typeModels/issueDetails.py b/backend/kernelCI_app/typeModels/issueDetails.py index 08e353ac1..58bbe58bb 100644 --- a/backend/kernelCI_app/typeModels/issueDetails.py +++ b/backend/kernelCI_app/typeModels/issueDetails.py @@ -38,33 +38,33 @@ class IssueDetailsPathParameters(BaseModel): class IssueBuildItem(BaseModel): - id: Build__Id = Field(alias="build__id") - architecture: Build__Architecture = Field(alias="build__architecture") - config_name: Build__ConfigName = Field(alias="build__config_name") - valid: Build__Valid = Field(alias="build__valid") - start_time: Build__StartTime = Field(alias="build__start_time") - duration: Build__Duration = Field(alias="build__duration") - compiler: Build__Compiler = Field(alias="build__compiler") - log_url: Build__LogUrl = Field(alias="build__log_url") - tree_name: Checkout__TreeName = Field(alias="build__checkout__tree_name") + id: Build__Id = Field(validation_alias="build__id") + architecture: Build__Architecture = Field(validation_alias="build__architecture") + config_name: Build__ConfigName = Field(validation_alias="build__config_name") + valid: Build__Valid = Field(validation_alias="build__valid") + start_time: Build__StartTime = Field(validation_alias="build__start_time") + duration: Build__Duration = Field(validation_alias="build__duration") + compiler: Build__Compiler = Field(validation_alias="build__compiler") + log_url: Build__LogUrl = Field(validation_alias="build__log_url") + tree_name: Checkout__TreeName = Field(validation_alias="build__checkout__tree_name") git_repository_branch: Checkout__GitRepositoryBranch = Field( - alias="build__checkout__git_repository_branch" + validation_alias="build__checkout__git_repository_branch" ) class IssueTestItem(BaseModel): - id: Test__Id = Field(alias="test__id") - status: Test__Status = Field(alias="test__status") - duration: Test__Duration = Field(alias="test__duration") - path: Test__Path = Field(alias="test__path") - start_time: Test__StartTime = Field(alias="test__start_time") + id: Test__Id = Field(validation_alias="test__id") + status: Test__Status = Field(validation_alias="test__status") + duration: Test__Duration = Field(validation_alias="test__duration") + path: Test__Path = Field(validation_alias="test__path") + start_time: Test__StartTime = Field(validation_alias="test__start_time") environment_compatible: Test__EnvironmentCompatible = Field( - alias="test__environment_compatible" + validation_alias="test__environment_compatible" ) - environment_misc: Test__EnvironmentMisc = Field(alias="test__environment_misc") - tree_name: Checkout__TreeName = Field(alias="test__build__checkout__tree_name") + environment_misc: Test__EnvironmentMisc = Field(validation_alias="test__environment_misc") + tree_name: Checkout__TreeName = Field(validation_alias="test__build__checkout__tree_name") git_repository_branch: Checkout__GitRepositoryBranch = Field( - alias="test__build__checkout__git_repository_branch" + validation_alias="test__build__checkout__git_repository_branch" ) diff --git a/backend/kernelCI_app/typeModels/treeDetails.py b/backend/kernelCI_app/typeModels/treeDetails.py index 9efbcb15e..a4f602d7b 100644 --- a/backend/kernelCI_app/typeModels/treeDetails.py +++ b/backend/kernelCI_app/typeModels/treeDetails.py @@ -30,6 +30,6 @@ class TreeDetailsBuildsResponse(BaseModel): class TreeQueryParameters(BaseModel): - origin: str = "maestro" + origin: str git_url: str git_branch: str diff --git a/backend/kernelCI_app/views/treeDetailsSummaryView.py b/backend/kernelCI_app/views/treeDetailsSummaryView.py index 0c83c9ae4..2f61035ea 100644 --- a/backend/kernelCI_app/views/treeDetailsSummaryView.py +++ b/backend/kernelCI_app/views/treeDetailsSummaryView.py @@ -19,7 +19,7 @@ process_tests_issue, process_filters, ) -from kernelCI_app.typeModels.treeDetails import SummaryResponse +from kernelCI_app.typeModels.treeDetails import SummaryResponse, TreeQueryParameters from kernelCI_app.utils import ( convert_issues_dict_to_list, ) @@ -153,6 +153,8 @@ def _sanitize_rows(self, rows): @extend_schema( responses=SummaryResponse, + parameters=[TreeQueryParameters], + methods=["GET"], ) def get(self, request, commit_hash: str | None): rows = get_tree_details_data(request, commit_hash) diff --git a/backend/requests/issue-details-tests-get.sh b/backend/requests/issue-details-tests-get.sh index b7bd35d8e..e06a0dbab 100644 --- a/backend/requests/issue-details-tests-get.sh +++ b/backend/requests/issue-details-tests-get.sh @@ -1,7 +1,7 @@ # This will get the tests from the issue with the latest version, for a specific version pass ?version=n (n being an integer) http 'http://localhost:8000/api/issue/maestro:0820fe153b255bf52750bbf1fecb198d8772f5a9/tests' -HTTP/1.1 200 OK +# HTTP/1.1 200 OK # Allow: GET, HEAD, OPTIONS # Cache-Control: max-age=0 # Content-Length: 1589 @@ -92,4 +92,4 @@ HTTP/1.1 200 OK # "status": "FAIL", # "tree_name": "net-next" # } -# ] \ No newline at end of file +# ] diff --git a/backend/schema.yml b/backend/schema.yml index d350b8ace..d9cd85e9c 100644 --- a/backend/schema.yml +++ b/backend/schema.yml @@ -518,9 +518,9 @@ paths: - in: query name: origin schema: - default: maestro title: Origin type: string + required: true tags: - tree security: @@ -558,9 +558,9 @@ paths: - in: query name: origin schema: - default: maestro title: Origin type: string + required: true tags: - tree security: @@ -601,6 +601,24 @@ paths: schema: type: string required: true + - in: query + name: git_branch + schema: + title: Git Branch + type: string + required: true + - in: query + name: git_url + schema: + title: Git Url + type: string + required: true + - in: query + name: origin + schema: + title: Origin + type: string + required: true tags: - tree security: @@ -638,9 +656,9 @@ paths: - in: query name: origin schema: - default: maestro title: Origin type: string + required: true tags: - tree security: @@ -1266,19 +1284,16 @@ components: title: Git Repository Branch tree_name: anyOf: - - type: string + - $ref: '#/components/schemas/Checkout__TreeName' - type: 'null' - title: Tree Name issue_id: anyOf: - - type: string + - $ref: '#/components/schemas/Issue__Id' - type: 'null' - title: Issue Id issue_version: anyOf: - - type: integer + - $ref: '#/components/schemas/Issue__Version' - type: 'null' - title: Issue Version required: - id - architecture @@ -1599,37 +1614,37 @@ components: type: object IssueBuildItem: properties: - build__id: + id: $ref: '#/components/schemas/Build__Id' - build__architecture: + architecture: $ref: '#/components/schemas/Build__Architecture' - build__config_name: + config_name: $ref: '#/components/schemas/Build__ConfigName' - build__valid: + valid: $ref: '#/components/schemas/Build__Valid' - build__start_time: + start_time: $ref: '#/components/schemas/Build__StartTime' - build__duration: + duration: $ref: '#/components/schemas/Build__Duration' - build__compiler: + compiler: $ref: '#/components/schemas/Build__Compiler' - build__log_url: + log_url: $ref: '#/components/schemas/Build__LogUrl' - build__checkout__tree_name: + tree_name: $ref: '#/components/schemas/Checkout__TreeName' - build__checkout__git_repository_branch: + git_repository_branch: $ref: '#/components/schemas/Checkout__GitRepositoryBranch' required: - - build__id - - build__architecture - - build__config_name - - build__valid - - build__start_time - - build__duration - - build__compiler - - build__log_url - - build__checkout__tree_name - - build__checkout__git_repository_branch + - id + - architecture + - config_name + - valid + - start_time + - duration + - compiler + - log_url + - tree_name + - git_repository_branch title: IssueBuildItem type: object IssueBuildsResponse: @@ -1657,10 +1672,6 @@ components: $ref: '#/components/schemas/Issue__CulpritTool' culprit_harness: $ref: '#/components/schemas/Issue__CulpritHarness' - build_valid: - $ref: '#/components/schemas/Issue__BuildValid' - test_status: - $ref: '#/components/schemas/Issue__TestStatus' comment: $ref: '#/components/schemas/Issue__Comment' misc: @@ -1675,42 +1686,40 @@ components: - culprit_code - culprit_tool - culprit_harness - - build_valid - - test_status - comment - misc title: IssueDetailsResponse type: object IssueTestItem: properties: - test__id: + id: $ref: '#/components/schemas/Test__Id' - test__status: + status: $ref: '#/components/schemas/Test__Status' - test__duration: + duration: $ref: '#/components/schemas/Test__Duration' - test__path: + path: $ref: '#/components/schemas/Test__Path' - test__start_time: + start_time: $ref: '#/components/schemas/Test__StartTime' - test__environment_compatible: + environment_compatible: $ref: '#/components/schemas/Test__EnvironmentCompatible' - test__environment_misc: + environment_misc: $ref: '#/components/schemas/Test__EnvironmentMisc' - test__build__checkout__tree_name: + tree_name: $ref: '#/components/schemas/Checkout__TreeName' - test__build__checkout__git_repository_branch: + git_repository_branch: $ref: '#/components/schemas/Checkout__GitRepositoryBranch' required: - - test__id - - test__status - - test__duration - - test__path - - test__start_time - - test__environment_compatible - - test__environment_misc - - test__build__checkout__tree_name - - test__build__checkout__git_repository_branch + - id + - status + - duration + - path + - start_time + - environment_compatible + - environment_misc + - tree_name + - git_repository_branch title: IssueTestItem type: object IssueTestsResponse: @@ -1718,10 +1727,6 @@ components: $ref: '#/components/schemas/IssueTestItem' title: IssueTestsResponse type: array - Issue__BuildValid: - anyOf: - - type: boolean - - type: 'null' Issue__Comment: anyOf: - type: string @@ -1752,10 +1757,6 @@ components: anyOf: - type: string - type: 'null' - Issue__TestStatus: - anyOf: - - type: string - - type: 'null' Issue__Version: type: integer Jsonb: