Skip to content

Commit 6074c4e

Browse files
authored
Ensure API readiness for JMeter testing (#197)
* Ensure API readiness for JMeter testing: update README.md, OpenAPI, and application.properties * Addressed feedback: removed duplicate OpenAPI dependency, commented out redundant properties, refined README to eliminate duplication.
1 parent a720e85 commit 6074c4e

File tree

3 files changed

+63
-8
lines changed

3 files changed

+63
-8
lines changed

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<artifactId>spring-boot-starter-validation</artifactId>
8787
</dependency>
8888

89+
8990
<!-- Data stores and supporting libs -->
9091
<dependency>
9192
<groupId>org.hsqldb</groupId>

readme.md

+58-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# REST version of Spring PetClinic Sample Application (spring-framework-petclinic extend )
1+
# REST version of Spring PetClinic Sample Application (spring-framework-petclinic extension )
22

33
[![Java Build Status](https://github.com/spring-petclinic/spring-petclinic-rest/actions/workflows/maven-build.yml/badge.svg)](https://github.com/spring-petclinic/spring-petclinic-rest/actions/workflows/maven-build.yml)
44
[![Docker Build Status](https://github.com/spring-petclinic/spring-petclinic-rest/actions/workflows/docker-build.yml/badge.svg)](https://github.com/spring-petclinic/spring-petclinic-rest/actions/workflows/docker-build.yml)
@@ -35,12 +35,62 @@ You can then access petclinic here: [http://localhost:9966/petclinic/](http://lo
3535
There is an actuator health check route as well:
3636
* [http://localhost:9966/petclinic/actuator/health](http://localhost:9966/petclinic/actuator/health)
3737

38-
## OpenAPI REST API documentation
38+
## 📖 OpenAPI REST API Documentation
39+
This project provides a RESTful API for managing a veterinary clinic's **owners, pets, veterinarians, visits, and specialties**.
40+
41+
### **Access Swagger UI**
42+
Swagger UI is available at: [http://localhost:9966/petclinic/swagger-ui.html](http://localhost:9966/petclinic/swagger-ui.html).
43+
44+
API documentation (OAS 3.1) is accessible at: [http://localhost:9966/petclinic/v3/api-docs](http://localhost:9966/petclinic/v3/api-docs).
45+
46+
47+
## 📌 API Endpoints Overview
48+
49+
| **Method** | **Endpoint** | **Description** |
50+
|-----------|------------|----------------|
51+
| **Owners** | | |
52+
| **GET** | `/api/owners` | Retrieve all pet owners |
53+
| **GET** | `/api/owners/{ownerId}` | Get a pet owner by ID |
54+
| **POST** | `/api/owners` | Add a new pet owner |
55+
| **PUT** | `/api/owners/{ownerId}` | Update an owner’s details |
56+
| **DELETE** | `/api/owners/{ownerId}` | Delete an owner |
57+
| **GET** | `/api/owners/{ownerId}/pets/{petId}` | Get a pet by ID (owner’s pet) |
58+
| **PUT** | `/api/owners/{ownerId}/pets/{petId}` | Update pet details (owner’s pet) |
59+
| **POST** | `/api/owners/{ownerId}/pets` | Add a new pet to an owner |
60+
| **POST** | `/api/owners/{ownerId}/pets/{petId}/visits` | Add a vet visit for a pet |
61+
| **Pets** | | |
62+
| **GET** | `/api/pets` | Retrieve all pets |
63+
| **GET** | `/api/pets/{petId}` | Get a pet by ID |
64+
| **POST** | `/api/pets` | Add a new pet |
65+
| **PUT** | `/api/pets/{petId}` | Update pet details |
66+
| **DELETE** | `/api/pets/{petId}` | Delete a pet |
67+
| **Vets** | | |
68+
| **GET** | `/api/vets` | Retrieve all veterinarians |
69+
| **GET** | `/api/vets/{vetId}` | Get a vet by ID |
70+
| **POST** | `/api/vets` | Add a new vet |
71+
| **PUT** | `/api/vets/{vetId}` | Update vet details |
72+
| **DELETE** | `/api/vets/{vetId}` | Delete a vet |
73+
| **Pet Types** | | |
74+
| **GET** | `/api/pettypes` | Retrieve all pet types |
75+
| **GET** | `/api/pettypes/{petTypeId}` | Get a pet type by ID |
76+
| **POST** | `/api/pettypes` | Add a new pet type |
77+
| **PUT** | `/api/pettypes/{petTypeId}` | Update pet type details |
78+
| **DELETE** | `/api/pettypes/{petTypeId}` | Delete a pet type |
79+
| **Specialties** | | |
80+
| **GET** | `/api/specialties` | Retrieve all vet specialties |
81+
| **GET** | `/api/specialties/{specialtyId}` | Get a specialty by ID |
82+
| **POST** | `/api/specialties` | Add a new specialty |
83+
| **PUT** | `/api/specialties/{specialtyId}` | Update a specialty |
84+
| **DELETE** | `/api/specialties/{specialtyId}` | Delete a specialty |
85+
| **Visits** | | |
86+
| **GET** | `/api/visits` | Retrieve all vet visits |
87+
| **GET** | `/api/visits/{visitId}` | Get a visit by ID |
88+
| **POST** | `/api/visits` | Add a new visit |
89+
| **PUT** | `/api/visits/{visitId}` | Update a visit |
90+
| **DELETE** | `/api/visits/{visitId}` | Delete a visit |
91+
| **Users** | | |
92+
| **POST** | `/api/users` | Create a new user |
3993

40-
You can reach the Swagger UI with this URL (after application start):
41-
[http://localhost:9966/petclinic/](http://localhost:9966/petclinic/swagger-ui.html).
42-
43-
You then can get the Open API description reaching this URL: [localhost:9966/petclinic/v3/api-docs](localhost:9966/petclinic/v3/api-docs).
4494

4595
## Screenshot of the Angular client
4696

@@ -61,7 +111,7 @@ A similar setup is provided for MySQL and PostgreSQL if a persistent database co
61111
Note that whenever the database type changes, the app needs to run with a different profile: `spring.profiles.active=mysql` for MySQL or `spring.profiles.active=postgres` for PostgreSQL.
62112
See the [Spring Boot documentation](https://docs.spring.io/spring-boot/how-to/properties-and-configuration.html#howto.properties-and-configuration.set-active-spring-profiles) for more detail on how to set the active profile.
63113
You can also change profile defined in the `application.properties` file.
64-
For MySQL database, it is needed to change param `hsqldb` to `mysql` in the following line of `application.properies` file:
114+
For MySQL database, it is needed to change param `hsqldb` to `mysql` in the following line of `application.properties` file:
65115
```properties
66116
spring.profiles.active=hsqldb,spring-data-jpa
67117
```
@@ -196,7 +246,7 @@ File -> Import -> Maven -> Existing Maven project
196246

197247
## Publishing a Docker image
198248

199-
This application uses [Google Jib]([https://github.com/GoogleContainerTools/jib) to build an optimized Docker image into the [Docker Hub](https://cloud.docker.com/u/springcommunity/repository/docker/springcommunity/spring-petclinic-rest/) repository.
249+
This application uses [Google Jib](https://github.com/GoogleContainerTools/jib) to build an optimized Docker image into the [Docker Hub](https://cloud.docker.com/u/springcommunity/repository/docker/springcommunity/spring-petclinic-rest/) repository.
200250
The [pom.xml](pom.xml) has been configured to publish the image with a the `springcommunity/spring-petclinic-rest`image name.
201251

202252
Command line to run:

src/main/resources/application.properties

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ spring.sql.init.data-locations=classpath*:db/${database}/data.sql
3232
spring.messages.basename=messages/messages
3333
spring.jpa.open-in-view=false
3434

35+
# OpenAPI/Swagger UI (Defaults to true)
36+
#springdoc.api-docs.enabled=true
37+
#springdoc.swagger-ui.enabled=true
38+
3539
logging.level.org.springframework=INFO
3640
#logging.level.org.springframework=DEBUG
3741

0 commit comments

Comments
 (0)