{"id":21528224,"url":"https://github.com/znsio/specmatic-coding-test","last_synced_at":"2025-04-05T23:08:05.311Z","repository":{"id":240513720,"uuid":"802736549","full_name":"znsio/specmatic-coding-test","owner":"znsio","description":"Specmatic Coding Test","archived":false,"fork":false,"pushed_at":"2025-03-19T15:48:12.000Z","size":801,"stargazers_count":19,"open_issues_count":0,"forks_count":99,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T22:06:26.837Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/znsio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-19T05:56:36.000Z","updated_at":"2025-03-19T15:48:16.000Z","dependencies_parsed_at":"2024-08-23T06:42:55.492Z","dependency_job_id":"f90e6a65-77fa-48cb-9a67-ae50da2745f1","html_url":"https://github.com/znsio/specmatic-coding-test","commit_stats":null,"previous_names":["znsio/specmatic-coding-test"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znsio%2Fspecmatic-coding-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znsio%2Fspecmatic-coding-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znsio%2Fspecmatic-coding-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znsio%2Fspecmatic-coding-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/znsio","download_url":"https://codeload.github.com/znsio/specmatic-coding-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411234,"owners_count":20934653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T01:52:16.334Z","updated_at":"2025-04-05T23:08:05.277Z","avatar_url":"https://github.com/znsio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Specmatic Coding Test\n\n### Prerequisites:\nJDK 17+ OR Specmatic IDE Plugin\n\n### Instructions:\n\n### 1. Fork this repository on Github. Checkout your forked repo to your local machine.  \n\n**DO NOT RAISE A PR AND SHARE YOUR SOLUTION WITH THE WORLD**\n\n#### Java/Kotlin Steps\n\nFrom a terminal, run the following command:\n```shell\nmvn clean test\n```\nYou should see 84 failing tests:\n```\n[ERROR] Tests run: 84, Failures: 84, Errors: 0, Skipped: 0\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD FAILURE\n[INFO] ------------------------------------------------------------------------\n```\n\n#### IDE Plugin Steps (Programming Language Agnostic)\n1. Install [Specmatic VS Code Extension](https://marketplace.visualstudio.com/items?itemName=Specmatic.specmatic-vscode-extension) or [Jetbrains IDEs Plugin](https://plugins.jetbrains.com/plugin/24548-specmatic)\n2. Launch command pallet and type \"Run Contract Tests\", this should launch the Specmatic plugin\n3. In the Contract Test Settings screen, update the following:\n  * Update API specification file to ./products_api.yaml\n  * Select the checkbox for Generative tests\n  * Click on the \"Save and Run\" button\n4. You should see 84 failing tests:\n\n```\n[ERROR] Tests run: 84, Failures: 84, Errors: 0, Skipped: 0\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD FAILURE\n[INFO] ------------------------------------------------------------------------\n```\n![Specmatic VSCode Extension Screenshot](assets/specmatic-coding-test-vs-code-plugin.png)\n\n## Objective of this Assignment\nYour objective is to get all the tests to pass by following the rest of the instructions.\n\n### 2. Introduction to Specmatic\n- Watch the [Contract-Driven Development - Turn your API Specification into Executable Contracts](https://www.youtube.com/watch?v=7OvTanLjm20\u0026list=PL9Z-JgiTsOYT66JOxf9c63AzhsK3Jay8P) video on Specmatic. \n- This will really help you to understand how Specmatic works and is necessary background/context about the project. \n\n### 3. Part 1 - Implement REST endpoints:\n\n#### Java/Kotlin Steps\n- This is a Kotlin based Spring Boot application.  \n- You are expected to implement the missing endpoints in the **Products** controller.\n\n#### Note:\n- You are **not** expected to use a database. Instead, use an in memory map to store and retrieve products.\n- Feel free to leverage GPT or Github Copilot.\n- Please do not alter the following files:\n  - ContractTest.kt\n  - products_api.yaml\n  - specmatic.json\n\n#### Other Programming Languages Steps\n- Pick any programming language and Web API framework of your choice.\n- You are expected to implement the missing endpoints.\n\n### 4. Part 1 - Definition of Done\n- All 84 tests are passing\n- 100% API Coverage from 1 path is achieved\n- Code changes are committed to your Github repo.\n\n### 5. Part 2 - Added property 'cost' to the ProductDetails schema\n- Update the products_api.yaml OpenAPI specification such that 'cost' is added as a new property to ProductDetails\n- This will increase the test count to 197 and cause a few tests to fail\n- Update your kotlin code to make all the tests pass again.\n\n### 6. Part 2 - Ensure Backward Compatibility is not broken\n```shell\nmvn exec:java\n```\nYou should see:\n```\nThe newer contract is backward compatible\n```\n\n### 7. Part 2 - Definition of Done\n- All 197 tests are passing\n- 100% API Coverage is still maintained\n- Code changes are committed to your Github repo.\n\n### 8. Trigger the CI pipeline under Github Actions. \n- Make sure all tests are passing on the pipeline as well.\n- Email the following details to coding.test@specmatic.io:\n  - Screenshot of passing CI pipeline\n  - Screenshot of API Coverage report\n  - Link to you github repo\n\n### _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)\n\n### 9. Judging Criteria\n- All 197 tests are passing in the Github Actions (CI pipeline)\n- 100% API Coverage\n- **3 Design Values** are met:\n  - Communication\n  - Simplicity\n  - Flexibility\n- **Kent Beck's 4 Rules of Simple Design** are followed:\n  - Passes the tests (197 Contract Tests + Bonus points if you write unit tests)\n  - Reveals intention (Self-documenting and expressive code)\n  - No duplication (Avoid any form of duplication - Literal, Semantic, Structural or Data)\n  - Fewest elements (Minimalistic Code - No combinatorial explosion)\n- **XP Principles**\n  - YAGNI - You Aren't Gonna Need It\n  - KISS - Keep It Simple, Stupid\n  - Triangulate\n  - DRY - Don't Repeat yourself\n- Make sure you adhere to your Programming Pradigm specific Design Principles:\n  - **Object Oriented**\n    - Single Responsibility Principle (SRP) \n    - Open Closed Principle (OCP)\n    - Liskov Substitution Principle (LSP)\n    - Interface Segregation Principle (ISP)\n    - Dependency Inversion Principle (DIP)\n    - Once and Only Once\n    - TDA - Tell Don't Ask\n    - The Law of Demeter\n  - **Functional Programming**\n    - First-Class and Higher-Order Functions\n    - Pure, Side-Effect Free Functions\n      - Idempotence\n      - Thread-safe Evaluation and Parallelism\n      - Deforestation - Transforming programs to eliminate trees\n      - Immutability\n      - Referential Transparency\n    - Declarative Programming\n    - Tackling complexity by composing functions\n      - Curry / Partial Functional Application\n      - Point-free Programming\n    - Using Monads to DRY the code\n    - Being efficient by being lazy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznsio%2Fspecmatic-coding-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fznsio%2Fspecmatic-coding-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznsio%2Fspecmatic-coding-test/lists"}