Skip to content

Commit

Permalink
Added a backward compatibility command to ensure changes to open API …
Browse files Browse the repository at this point in the history
…spec file are backward compatible
  • Loading branch information
nashjain committed Jun 26, 2024
1 parent df0a013 commit 0b6f934
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 9 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ JDK 17+ OR Specmatic IDE Plugin
#### Java/Kotlin Steps

From a terminal, run the following command:
```bash
```shell
mvn clean test
```
You should see 84 failing tests:
```bash
```
[ERROR] Tests run: 84, Failures: 84, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
Expand All @@ -33,7 +33,7 @@ You should see 84 failing tests:
* Click on the "Save and Run" button
4. You should see 84 failing tests:

```bash
```
[ERROR] Tests run: 84, Failures: 84, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
Expand Down Expand Up @@ -72,17 +72,26 @@ Your objective is to get all the tests to pass by following the rest of the inst
- 100% API Coverage from 1 path is achieved
- Code changes are committed to your Github repo.

### 5. Part 2 - Added mandatory property 'cost' to the ProductDetails schema
- Update the products_api.yaml OpenAPI specification such that 'cost' is added as a new mandatory property to ProductDetails
### 5. Part 2 - Added property 'cost' to the ProductDetails schema
- Update the products_api.yaml OpenAPI specification such that 'cost' is added as a new property to ProductDetails
- This will increase the test count to 197 and cause a few tests to fail
- Update your kotlin code to make all the tests pass again.

### 6. Part 2 - Definition of Done
### 6. Part 2 - Ensure Backward Compatibility is not broken
```shell
mvn exec:java
```
You should see:
```
The newer contract is backward compatible
```

### 7. Part 2 - Definition of Done
- All 197 tests are passing
- 100% API Coverage is still maintained
- Code changes are committed to your Github repo.

### 7. Trigger the CI pipeline under Github Actions.
### 8. Trigger the CI pipeline under Github Actions.
- Make sure all tests are passing on the pipeline as well.
- Email the following details to [email protected]:
- Screenshot of passing CI pipeline
Expand All @@ -91,7 +100,7 @@ Your objective is to get all the tests to pass by following the rest of the inst

### _If you like Specmatic, please give us a star on GitHub!_ [![GitHub Repo stars](https://img.shields.io/github/stars/znsio/specmatic?logo=GitHub)](https://github.com/znsio/specmatic/stargazers)

### 8. Judging Criteria
### 9. Judging Criteria
- All 197 tests are passing in the Github Actions (CI pipeline)
- 100% API Coverage
- **3 Design Values** are met:
Expand Down
41 changes: 40 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring.boot.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
Expand All @@ -44,7 +50,6 @@
<version>${spring.boot.version}</version>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
Expand Down Expand Up @@ -225,6 +230,40 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>application.SpecmaticApplication</mainClass>
<arguments>
<argument>compatible</argument>
<argument>git</argument>
<argument>file</argument>
<argument>products_api.yaml</argument>
</arguments>
<includePluginDependencies>true</includePluginDependencies>
</configuration>
<dependencies>
<dependency>
<groupId>in.specmatic</groupId>
<artifactId>junit5-support</artifactId>
<version>${specmatic.version}</version>
</dependency>
<dependency>
<groupId>in.specmatic</groupId>
<artifactId>specmatic-executable</artifactId>
<version>${specmatic.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 0b6f934

Please sign in to comment.