Skip to content

Onedy/inditex-shop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shop API

This is an API first hexagonal-architecture microservice that serves information about products.

Steps in its creation:

  1. First, the project was generated with Spring initialzr (https://start.spring.io/).
  2. Added openapi-generator in order to generate the API and DTOs from main/resources/api.yml
  3. Moved back from Spring boot 3.0.3 to 2.7.9 because 3.0.0 transitioned to JakartaEE 9 and openapi-generator does not fully support it yet (OpenAPITools/openapi-generator#13124)
  4. Created database (flyway)
  5. Implemented endpoint (tests, controller, service, mapper, product factory)
  6. Refactor and added swagger-ui
  7. Migrated to hexagonal architecture
  8. Release

API docs are also auto generated based on the OpenAPI 3 specification from annotations, available at

Swagger integration available at http://localhost:8080/swagger-ui.html

Tests can be run with ./mvnw clean test

About hexagonal architecture

Hexagonal architecture is a model of designing software applications around domain logic to isolate it from external factors.

In order to achieve this, the code is divided into three layers: application (outside), domain (inside) and infrastructure (outside).

Manually test the microservice

To start the microservice, execute the following command in the root folder of the project:

./mvnw clean package && java -jar target/shop-0.1.1.jar

and you will be able to test the endpoint in the swagger-ui: http://localhost:8080/swagger-ui.html

Dataset

Provided dataset is loaded via flyway and is tested in ProductIntegrationTest.java

Improvements

  1. Decouple domain POJOs from entity POJOs in order to normalize Product class (Product should contain a price and a branch, and the price shouldn't contain a product)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages