Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Add architecture test for endpoint naming conventions #8493

Merged
merged 18 commits into from
May 11, 2024

Conversation

Strohgelaender
Copy link
Contributor

@Strohgelaender Strohgelaender commented Apr 28, 2024

Checklist

General

Server

Motivation and Context

We want to enforce consistency when setting endpoint path values.

Description

This adds an architecture test checking for leading and trailing slashes in request mapping annotations.

Steps for Testing

code review

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Summary by CodeRabbit

  • New Features

    • Enhanced API endpoint consistency across various resources by standardizing URL path formats.
    • Improved dynamic registration for LTI 1.3 configurations.
  • Bug Fixes

    • Corrected API endpoint paths in multiple resources to ensure proper access and functionality.
  • Documentation

    • Updated API annotations for clarity and compliance with standard practices.
  • Refactor

    • Standardized endpoint declarations across multiple classes to improve maintainability and readability.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) labels Apr 28, 2024
@Strohgelaender Strohgelaender marked this pull request as ready for review April 28, 2024 16:37
@Strohgelaender Strohgelaender requested a review from a team as a code owner April 28, 2024 16:37
Copy link

coderabbitai bot commented Apr 28, 2024

Walkthrough

The recent updates focus on standardizing API endpoint paths across various resources in the Artemis project. By removing incorrect leading slashes and adjusting @RequestMapping annotations, the changes aim to enhance consistency and streamline endpoint definitions. This effort can simplify development and testing processes, potentially improving overall code maintainability.

Changes

Files Change Summary
CustomLti13Configurer.java Corrected LTI13_BASE_PATH definition by adding a leading slash and adjusting loginPath.
AeolusTemplateResource.java, ApollonDiagramResource.java, TextSubmissionResource.java, GroupChatResource.java, OneToOneChatResource.java Updated @RequestMapping or @GetMapping annotations to include/exclude trailing/leading slashes.
CompetencyResource.java, ModelingSubmissionResource.java, ProgrammingExerciseParticipationResource.java Removed leading slashes from @PostMapping or @GetMapping annotations.
LectureResource.java, BuildJobQueueResource.java Modified @GetMapping annotation paths.
QuizExerciseResource.java, RepositoryProgrammingExerciseParticipationResource.java Updated @PostMapping, @PutMapping, and @GetMapping annotations.
StudentExamResource.java, AdminBuildJobQueueResource.java, AdminLtiConfigurationResource.java, ProgrammingExerciseResource.java, PushNotificationResource.java Adjusted endpoint paths in annotations.
TeamResource.java Modified @GetMapping annotation path.
ChannelResource.java, ConversationResource.java Updated @RequestMapping annotations.
PublicOAuth2JWKSResource.java, ResourceArchitectureTest.java Removed leading slash from @GetMapping annotation.
Lti13LaunchIntegrationTest.java Refactored endpoint paths related to LTI 1.3 authentication callbacks.
AbstractArchitectureTest.java, ArchitectureTest.java Added new methods and conditions related to @RequestMapping annotations.

Possibly related issues

  • Parsing of server sided endpoints #8429: The recent changes align with the automation goals of this issue by standardizing endpoint paths, facilitating easier parsing and analysis. This standardization could support efficient endpoint identification in GitHub actions development as described in the issue.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 69934c7 and 2cd4552.
Files selected for processing (1)
  • src/main/java/de/tum/in/www1/artemis/web/rest/QuizExerciseResource.java (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/de/tum/in/www1/artemis/web/rest/QuizExerciseResource.java

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 28, 2024
Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

One comment: Maybe we should add URLs with the following pattern: {resourceId}/{resourceId} as a violation?

@Strohgelaender
Copy link
Contributor Author

We currently have some violations here, e.g. files/attachments/lecture/{lectureId}/{filename}. Since these are endpoints that are also used by the Artemis-Apps, I'll not touch them in this PR.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 1, 2024
Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just two minor comments 👍

…figurer.java

Co-authored-by: Raphael Stief <118574504+rstief@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes May 2, 2024
rstief
rstief previously approved these changes May 2, 2024
Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

@Strohgelaender Strohgelaender added this to the 7.0.4 milestone May 2, 2024
coolchock
coolchock previously approved these changes May 2, 2024
Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM

@Strohgelaender Strohgelaender dismissed stale reviews from coderabbitai[bot] and rstief via 927632d May 5, 2024 16:56
coderabbitai[bot]
coderabbitai bot previously approved these changes May 5, 2024
marlon-luca-bu
marlon-luca-bu previously approved these changes May 7, 2024
Copy link
Contributor

@marlon-luca-bu marlon-luca-bu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice improvement 👍 ... Code LGTM

DominikRemo
DominikRemo previously approved these changes May 7, 2024
Copy link
Contributor

@DominikRemo DominikRemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM and tests succeed

@krusche krusche modified the milestones: 7.0.4, 7.0.5 May 7, 2024
Copy link
Contributor

@laadvo laadvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

@krusche krusche added the maintainer-approved The feature maintainer has approved the PR label May 11, 2024
@krusche krusche merged commit f74d5c5 into develop May 11, 2024
19 of 21 checks passed
@krusche krusche deleted the chore/endpoint-namings branch May 11, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer-approved The feature maintainer has approved the PR ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.