Skip to content

Commit 3401ab2

Browse files
Initial commit
0 parents  commit 3401ab2

40 files changed

Lines changed: 20408 additions & 0 deletions

.gitattributes

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Set default behavior to automatically normalize line endings
2+
* text=auto eol=lf
3+
4+
# Force specific line endings for some file types
5+
*.js text eol=lf
6+
*.ts text eol=lf
7+
*.jsx text eol=lf
8+
*.tsx text eol=lf
9+
*.json text eol=lf
10+
*.md text eol=lf
11+
*.html text eol=lf
12+
*.css text eol=lf
13+
*.scss text eol=lf
14+
*.yml text eol=lf
15+
*.yaml text eol=lf
16+
17+
# Mark all images and binaries as binary
18+
*.png binary
19+
*.jpg binary
20+
*.jpeg binary
21+
*.gif binary
22+
*.ico binary
23+
*.svg binary
24+
*.webp binary
25+
*.pdf binary
26+
27+
# Node modules (ignored by git anyway, but safe)
28+
node_modules/** export-ignore
29+
30+
# Docusaurus build output
31+
/build/** export-ignore
32+
/.docusaurus/** export-ignore
33+
34+
# Lock files
35+
package-lock.json text eol=lf
36+
yarn.lock text eol=lf
37+
pnpm-lock.yaml text eol=lf
38+
39+
# Misc
40+
*.lock text eol=lf
41+
.DS_Store binary
42+
Thumbs.db binary

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "quarterly"
7+
target-branch: main
8+
open-pull-requests-limit: 10
9+
allow:
10+
- dependency-type: "direct"
11+
ignore:
12+
- dependency-name: "*"
13+
update-types:
14+
- "version-update:semver-major"
15+
16+
- package-ecosystem: "github-actions"
17+
directory: "/"
18+
schedule:
19+
interval: "quarterly"
20+
target-branch: main
21+
open-pull-requests-limit: 10
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
name: Build
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 22
31+
cache: npm
32+
33+
- name: Install Dependencies
34+
run: npm ci
35+
36+
- name: Build
37+
run: npm run build
38+
39+
- name: Upload Pages Artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: build
43+
44+
deploy:
45+
name: Deploy
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
runs-on: ubuntu-latest
50+
needs: build
51+
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Damian Malczewski
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```bash
8+
npm install
9+
```
10+
11+
## Local Development
12+
13+
```bash
14+
npm start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```bash
22+
npm run build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
Using SSH:
30+
31+
```bash
32+
USE_SSH=true npm run deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```bash
38+
GIT_USER=<Your GitHub username> npm run deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
slug: 2025-12-28-problem4j-project-launch
3+
title: Problem4J Project Launch
4+
authors: malczuuu
5+
tags: [hello, release]
6+
---
7+
8+
Hi everyone 👋
9+
10+
Allow me to introduce Problem4J to y'all. It's another set of Java libraries implementing **RFC7807 - Problem Details
11+
for HTTP APIs**.
12+
13+
Problem4J is a package of libraries that introduces RFC Problem Details to the Java ecosystem. It combines an
14+
imperative approach, based on extending a common exception type (`ProblemException`), with a declarative,
15+
annotation-based approach (via `@ProblemMapping`). As a primary set of modules, `problem4j-core`, `problem4j-jackson`,
16+
and `problem4j-spring` were introduced, providing a core (framework-agnostic) module, Jackson integration (both v2 -
17+
`com.fasterxml.jackson` and v3 - `tools.jackson`), as well as Spring Boot integration (supporting both leading versions
18+
\- v3 and v4). Other integrations may (or may not) eventually arrive.
19+
20+
<!-- truncate -->
21+
22+
**Why should I care?**
23+
24+
If you are building HTTP APIs in Java, Problem4J aims to reduce the boilerplate around error handling while keeping
25+
your domain logic clean and explicit. By clearly separating the `Problem` representation from exceptions, and by
26+
offering both imperative and declarative mapping options, the library helps you produce consistent, standards-compliant
27+
error responses without tightly coupling your code to a specific framework. This becomes especially useful in high-end
28+
framework applications (such as Spring Boot), where sensible defaults and simple extension points can significantly
29+
improve both developer experience and maintainability.
30+
31+
---
32+
33+
The following modules and versions are considered the first public releases of this library. Previous versions were
34+
developed as a "personal playground" under the `io.github.malczuuu.problem4j` group namespace.
35+
36+
* Core
37+
* `io.github.problem4j:problem4j-core:1.3.0`
38+
* Jackson Integration
39+
* `io.github.problem4j:problem4j-jackson2:1.3.0` (Jackson 2 - `com.fasterxml.jackson`)
40+
* `io.github.problem4j:problem4j-jackson3:1.3.0` (Jackson 3 - `tools.jackson`)
41+
* Spring Boot 3.x Integration
42+
* `io.github.problem4j:problem4j-spring-bom:1.2.0`
43+
* `io.github.problem4j:problem4j-spring-web:1.2.0`
44+
* `io.github.problem4j:problem4j-spring-webflux:1.2.0`
45+
* `io.github.problem4j:problem4j-spring-webmvc:1.2.0`
46+
* Spring Boot 4.x Integration
47+
* `io.github.problem4j:problem4j-spring-bom:2.1.0`
48+
* `io.github.problem4j:problem4j-spring-web:2.1.0`
49+
* `io.github.problem4j:problem4j-spring-webflux:2.1.0`
50+
* `io.github.problem4j:problem4j-spring-webmvc:2.1.0`
51+
52+
---
53+
54+
The main inspiration was the idea of taking a slightly different approach than [`zalando/problem`][zalando-problem], as
55+
well as the fact that [`zalando/problem-spring-web`][zalando-problem-spring-web] does not seem to have received an
56+
update for Spring Boot 4 at the time of writing this post. What differentiates this library from Zalando's is the
57+
separation of the `Problem` model from the throwable `ProblemException`, including a declarative approach with
58+
`@ProblemMapping` annotation, as well as making Spring Boot's predefined exception handlers more beginner-friendly
59+
(simple `ProblemResolver` implementations declared as `@Component`s). Moreover, predefined Spring Boot error messages
60+
tend to hide exception internals and do not expose plain exception messages in HTTP responses.
61+
62+
---
63+
64+
Feedback, ideas, and contributions are very welcome 🚀
65+
66+
**References**
67+
68+
* [RFC7807 - Problem Details for HTTP APIs][rfc7807]
69+
* [RFC9457 - Problem Details for HTTP APIs][rfc9457]
70+
71+
[rfc7807]: https://datatracker.ietf.org/doc/html/rfc7807
72+
73+
[rfc9457]: https://datatracker.ietf.org/doc/html/rfc9457
74+
75+
[zalando-problem]: https://github.com/zalando/problem
76+
77+
[zalando-problem-spring-web]: https://github.com/zalando/problem-spring-web

blog/authors.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
malczuuu:
2+
name: Damian Malczewski
3+
title: Creator of Problem4J
4+
url: https://github.com/malczuuu
5+
image_url: https://github.com/malczuuu.png
6+
page: true
7+
socials:
8+
github: malczuuu

blog/tags.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
hello:
2+
label: Hello
3+
permalink: /hello
4+
description: Introduction of project and/or project friends
5+
6+
release:
7+
label: Release
8+
permalink: /release
9+
description: Project releases

docs/01-intro.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Intro
6+
7+
Designing clear and consistent error responses in a REST API is often harder than it looks. Without a shared standard,
8+
each application ends up inventing its own ad-hoc format, which quickly leads to inconsistency and confusion.
9+
[RFC 7807 - Problem Details for HTTP APIs][rfc7807] solves this by defining a simple, extensible JSON structure for
10+
error messages.
11+
12+
**Problem4J** brings this specification into the Java ecosystem, offering a practical way to model, throw, and handle
13+
API errors using `Problem` objects. It helps you enforce a consistent error contract across your services, while staying
14+
flexible enough for custom exceptions and business-specific details.
15+
16+
> Note that [RFC 7807][rfc7807] was later extended in [RFC 9457][rfc9457], however core concepts remain the same.
17+
18+
An example of `application/problem+json` response on HTTP API would look as follows.
19+
20+
```json
21+
{
22+
"status" : 400,
23+
"title" : "Bad Request",
24+
"detail" : "Validation failed",
25+
"errors" : [ {
26+
"field" : "email",
27+
"error" : "must be a well-formed email address"
28+
}, {
29+
"field" : "age",
30+
"error" : "must be greater than or equal to 18"
31+
} ]
32+
}
33+
```
34+
35+
Problem4J itself aims to be generic enough to allow implementing integrations with various frameworks. Currently the
36+
only integrated frameworks are Jackson (aka `ObjectMapper`) for JSON/XML serialization and deserialization and Spring
37+
Boot (in form of Spring WebFlux and WebMVC) as a primary web framework presenting Problem4J in action. Please visit
38+
appropriate documentation pages for more info. Other integrations may come as well, but please note that nothing is
39+
considered as promised.
40+
41+
Minor information about resons for Problem4J's inception are described in the first blog post -
42+
[Problem4J Project Launch](/blog/2025-12-28-problem4j-project-launch).
43+
44+
[rfc7807]: https://datatracker.ietf.org/doc/html/rfc7807
45+
46+
[rfc9457]: https://datatracker.ietf.org/doc/html/rfc9457

0 commit comments

Comments
 (0)