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

feat(agora): create a spec-first REST API prototype in Java-Spring #2895

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

tschaffter
Copy link
Member

@tschaffter tschaffter commented Oct 12, 2024

Contributes to https://sagebionetworks.jira.com/browse/ARCH-309

Changelog

  • Create the project agora-api-spring based on openchallenges-image-service
  • Update the API to fetch the data version document from the MongoDB instance
  • Update docker/agora to start the service with nx serve-detach agora-api-spring

Benefits

  • Simplified overall Sage product architecture
    • Align Agora API architecture on OC architecture
  • Increased reusability of components
    • Existing OC backend code is available to Agora
  • Enhanced flexibility for engineering teams
  • Improved developer experience
    • Generate most of the code with the OpenAPI generator
    • Developers can focus on implementing the features
    • OC microservices provide strong examples
    • Add Swagger UI
    • Add live reload
    • Add unit test framework
  • Potential cost savings through resource optimization
    • Robust code generated by the OpenAPI Generator community

Preview

(Re)generate the API server after updating the Agora API description

nx run agora-api-spring:generate

Prepare the project

nx prepare agora-api-spring

Start the development server

nx serve agora-api-spring

Navigate to localhost:8086 to be redirected to the Swagger UI page.

Build the Docker image

nx build-image agora-api-spring

Serve the API with Docker

nx serve-detach agora-api-spring

Get the data version

With curl, using a command documented in Swagger UI:

$ curl -X 'GET' \
  'http://localhost:8086/v1/dataversion' \
  -H 'accept: application/json'
{"data_file":"syn13363290","data_version":"68","team_images_id":"syn12861877"}

In Swagger UI:

image

Swagger UI

image

@tschaffter tschaffter changed the title feat(agora): create a spec-first REST API in Java-Spring feat(agora): create a spec-first REST API prototype in Java-Spring Oct 12, 2024
@tschaffter tschaffter marked this pull request as ready for review October 12, 2024 04:58
@tschaffter tschaffter requested a review from a team as a code owner October 12, 2024 04:58
@tschaffter tschaffter self-assigned this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant