Skip to content

Commit 0052ecb

Browse files
committed
Adding OpenSpec example
1 parent cfe1c94 commit 0052ecb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2973
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Problem 1
2+
3+
## User Story Statement
4+
5+
- **As an** API consumer / data analyst
6+
- **I want to** consume God APIs (Greek, Roman & Nordic), filter gods whose names start with 'n', convert each filtered god name into a decimal representation, and return the sum of those values
7+
- **So that** I can perform cross-pantheon analysis and aggregate mythology data for research, reporting, or educational applications.
8+
9+
**Notes:**
10+
11+
- Decimal conversion: Each character in a god name is converted to its numeric code (e.g., ASCII/Unicode), and those values are summed per name. The final result is the sum of all such per-name sums.
12+
- Case sensitivity: Filtering for gods starting with `n` is case-sensitive (only lowercase `n`), consistent with the Gherkin below.
13+
14+
## Gherkin file
15+
16+
```gherkin
17+
Feature: God Analysis API
18+
# REST API: GET /api/v1/gods/stats/sum
19+
# Notes:
20+
# - Decimal Conversion Rule: Name then each char to its Unicode int value, then concatenate these ints as strings.
21+
# (e.g., "Zeus" -> Z(90)e(101)u(117)s(115) -> "90101117115").
22+
# - Outbound HTTP uses Spring RestClient with connect/read timeouts from application configuration (defaults in application.yml).
23+
# - If a source request hits the configured timeout, aggregation continues with the other sources (partial result).
24+
# - Filtering for gods starting with 'n' is case-sensitive (only lowercase 'n').
25+
# - Greek API: https://my-json-server.typicode.com/jabrena/latency-problems/greek
26+
# - Roman API: https://my-json-server.typicode.com/jabrena/latency-problems/roman
27+
# - Nordic API: https://my-json-server.typicode.com/jabrena/latency-problems/nordic
28+
29+
Background:
30+
Given the God Analysis API is available at "/api/v1"
31+
And the system is configured with HTTP connect and read timeouts for outbound RestClient calls (default 5 seconds in application configuration)
32+
33+
Scenario: Happy path - Get sum with explicit sources
34+
When the client sends a GET request to "/gods/stats/sum" with query parameters "filter" = "n" and "sources" = "greek,roman,nordic"
35+
Then the response status code should be 200
36+
And the response body should contain a JSON object with a "sum" field
37+
And the value of "sum" should be "78179288397447443426"
38+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
wrapperVersion=3.3.4
2+
distributionType=only-script
3+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.14/apache-maven-3.9.14-bin.zip
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Contributor Quickstart Guide
2+
3+
## Your role
4+
5+
You are an expert Java backend engineer specializing in APIs, services, and databases.
6+
7+
- You understand Spring Boot, REST API design, and backend service architecture
8+
- You help build and maintain Java backend applications with focus on API development
9+
- You work with databases, external service integrations, and backend business logic
10+
- You apply best practices for testing, error handling, and performance optimization
11+
12+
## Tech stack
13+
14+
- **Language:** Java 26
15+
- **Build:** Maven (wrapper: `./mvnw`)
16+
- **Framework:** Spring Boot 4.0.4
17+
- **Key Dependencies:** Spring Web, Spring Actuator; outbound HTTP via Spring `RestClient` with connect/read timeouts from configuration (no Resilience4j retries for US-001)
18+
- **Testing:** JUnit 5, Spring `RestClient` (acceptance tests), WireMock, Spring Boot Test
19+
- **Monitoring:** Spring Boot Actuator
20+
21+
## File structure
22+
23+
- `src/main/java/info/jab/ms/` – Main application source code using `info.jab.ms` package (WRITE here for business logic)
24+
- `src/main/resources/` – Configuration files and resources (WRITE here for config)
25+
- `src/test/java/info/jab/ms/` – Test source code using `info.jab.ms` package (WRITE here for tests)
26+
- `target/` – Generated build output (READ only, never edit directly)
27+
- `pom.xml` – Maven project configuration (WRITE here for dependencies)
28+
- `.mvn/` – Maven wrapper configuration (READ only)
29+
30+
### Package Structure
31+
- **Base package:** `info.jab.ms`
32+
33+
## Commands
34+
35+
```bash
36+
# Build and test the application
37+
./mvnw clean verify
38+
39+
# Run the application locally
40+
./mvnw spring-boot:run
41+
42+
# Run only unit tests
43+
./mvnw test
44+
45+
# Run only integration tests
46+
./mvnw failsafe:integration-test
47+
48+
# Package the application
49+
./mvnw clean package
50+
51+
# Clean build artifacts
52+
./mvnw clean
53+
```
54+
55+
## Git workflow
56+
57+
- **Conventional Commits**: Use conventional commit format for all commit messages
58+
- Format: `type(scope): description`
59+
- Types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
60+
- Examples:
61+
- `feat(api): add god stats aggregation endpoint`
62+
- `fix(controller): resolve timeout handling in external API calls`
63+
- `test(integration): add acceptance tests for filtering logic`
64+
- `docs(readme): update API documentation`
65+
66+
## Boundaries
67+
68+
-**Always do:** Run `./mvnw clean verify` before committing changes, write tests for new functionality, follow REST API best practices, handle errors gracefully, use proper HTTP status codes
69+
- ⚠️ **Ask first:** Adding new dependencies to pom.xml, changing application configuration, modifying API contracts, adding new external service integrations
70+
- 🚫 **Never do:** Edit target/ directory directly, commit secrets or credentials, skip tests before promoting changes, break existing API contracts without versioning

0 commit comments

Comments
 (0)