Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem JSON to M5 and register problem+json as an additional type for JSON Codec #251

Merged
merged 8 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ plugins {

repositories {
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
}

configurations.all {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
repositories {
mavenCentral()
maven { setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/") }
}
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ projectUrl=https://micronaut.io
githubSlug=micronaut-projects/micronaut-problem-json
developers=Sergio del Amo

# Micronaut core branch for BOM pull requests
githubCoreBranch=4.0.x

bomProperty=micronautProblemJsonVersion

org.gradle.caching=true
org.gradle.jvmargs=-Xmx1g
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[versions]

micronaut = "4.0.0-M2"
micronaut = "4.0.0-M5"
micronaut-docs = '2.0.0'
micronaut-test = "4.0.0-M1"
micronaut-test = "4.0.0-M4"

micronaut-serde = "2.0.0-M1"
micronaut-validation = "4.0.0-M4"
micronaut-serde = "2.0.0-M8"
micronaut-validation = "4.0.0-M7"

groovy = "4.0.11"
kotlin = '1.8.21'
spock = "2.3-groovy-4.0"

managed-zalando-problem="0.27.1"

micronaut-logging = "1.0.0-M2"
[libraries]
# Core
micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' }

# micronaut boms
micronaut-logging = { module = "io.micronaut.logging:micronaut-logging-bom", version.ref = "micronaut-logging" }
micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' }
micronaut-serde = { module = "io.micronaut.serde:micronaut-serde-bom", version.ref = "micronaut-serde" }
micronaut-validation = { module = "io.micronaut.validation:micronaut-validation-bom", version.ref = "micronaut-validation" }

Expand Down
2 changes: 2 additions & 0 deletions problem-json/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ dependencies {
testImplementation(mn.micronaut.http.server.netty)
testImplementation(mn.micronaut.http.client)
testAnnotationProcessor(mn.micronaut.inject.java)

testRuntimeOnly(mn.snakeyaml)
}
4 changes: 4 additions & 0 deletions problem-json/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
micronaut:
codec:
json:
additional-types: 'application/problem+json'
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

micronautBuild {
addSnapshotRepository()
importMicronautCatalog("micronaut-logging")
useStandardizedProjectNames = true
importMicronautCatalog()
importMicronautCatalog("micronaut-serde")
Expand Down
2 changes: 2 additions & 0 deletions src/main/docs/guide/breaks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Starting with Micronaut Framework 4.0.0, Micronaut Problem JSON is based on `jakarta.validation` rather than `javax.validation` as in previous versions.

It is necessary to <<codec,specify `application/problem+json` as an additional type for the JSON codec>>.

=== Micronaut Problem JSON 2.2.3

The default Problem+JSON payload does not include the `detail` field to avoid accidental information disclosure if the exception root cause is not of type `UnsatisfiedRouteException` or `ThrowableProblem` to avoid accidental information disclosure since 2.2.3.
Expand Down
6 changes: 6 additions & 0 deletions src/main/docs/guide/installation/codec.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use Micronaut Problem, specify `application/problem+json` as an additional type for the JSON codec.

[configuration]
----
include::problem-json/src/test/resources/application.yml[]
----
3 changes: 2 additions & 1 deletion src/main/docs/guide/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ introduction:
releaseHistory: Release History
breaks: Breaking Changes
installation:
Installation
title: Installation
codec: Additional JSON Codec
usage:
title: Usage
problemBuilder: Problem Builder
Expand Down
1 change: 1 addition & 0 deletions test-suite-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {
testImplementation projects.micronautProblemJson
testImplementation mn.micronaut.http.server.netty
testImplementation mn.micronaut.http.client
testRuntimeOnly(mn.snakeyaml)
}

tasks.named('test') {
Expand Down
4 changes: 4 additions & 0 deletions test-suite-groovy/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
micronaut:
codec:
json:
additional-types: 'application/problem+json'
1 change: 1 addition & 0 deletions test-suite-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
testImplementation mn.micronaut.http.server.netty
testImplementation mn.micronaut.http.client
testImplementation(mnSerde.micronaut.serde.jackson)
testRuntimeOnly(mn.snakeyaml)
}

tasks.named('test') {
Expand Down
4 changes: 4 additions & 0 deletions test-suite-kotlin/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
micronaut:
codec:
json:
additional-types: 'application/problem+json'
1 change: 1 addition & 0 deletions test-suite-serde-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies {
testImplementation mn.micronaut.http.client
testImplementation projects.micronautProblemJson
testImplementation(mnSerde.micronaut.serde.jackson)
testRuntimeOnly(mn.snakeyaml)
}
tasks.named('test') {
useJUnitPlatform()
Expand Down
4 changes: 4 additions & 0 deletions test-suite-serde-java/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
micronaut:
codec:
json:
additional-types: 'application/problem+json'
3 changes: 2 additions & 1 deletion test-suite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies {
testAnnotationProcessor mn.micronaut.inject.java
testAnnotationProcessor mnValidation.micronaut.validation.processor
testImplementation mnValidation.micronaut.validation
testImplementation mn.logback.classic
testImplementation mnLogging.logback.classic
testImplementation libs.junit.api
testImplementation mnTest.micronaut.test.junit5
testRuntimeOnly libs.junit.engine
Expand All @@ -17,6 +17,7 @@ dependencies {

testAnnotationProcessor(mnSerde.micronaut.serde.processor)
testImplementation(mnSerde.micronaut.serde.jackson)
testRuntimeOnly(mn.snakeyaml)
}

tasks.named('test') {
Expand Down
4 changes: 4 additions & 0 deletions test-suite/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
micronaut:
codec:
json:
additional-types: 'application/problem+json'