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

Create an initial version of the JSON schema processors #8

Merged
merged 42 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9dee537
Create an initial version of the JSON schema processors
andriy-dmytruk Apr 3, 2024
4e82221
add dependencies
sdelamo Apr 4, 2024
208e650
add tests
sdelamo Apr 4, 2024
af4b9e6
Update versions
andriy-dmytruk Apr 4, 2024
428a79f
doc: move relaese history to the end
sdelamo Apr 5, 2024
00c99b7
split docs
sdelamo Apr 5, 2024
a23be19
remove unused modules
sdelamo Apr 5, 2024
a8f3501
show generate file in the docs
sdelamo Apr 5, 2024
1f1ad5d
remove print input
sdelamo Apr 5, 2024
1011778
Merge pull request #9 from micronaut-projects/remove-print
andriy-dmytruk Apr 5, 2024
61bfacd
use id(“”) syntax to apply Gradle plugin
sdelamo Apr 8, 2024
1b25d00
remove maxHeapSize configuration
sdelamo Apr 8, 2024
5f4d32e
remove logback unncessary configuration
sdelamo Apr 8, 2024
8479391
remove empty dependencies block
sdelamo Apr 8, 2024
cfebf6c
Merge pull request #13 from micronaut-projects/remove-empty-dependenc…
andriy-dmytruk Apr 8, 2024
95aa553
Merge pull request #12 from micronaut-projects/remove-logback-config
andriy-dmytruk Apr 8, 2024
5d8ed10
Merge branch 'andriy/init' into remove-max-heap-size
andriy-dmytruk Apr 8, 2024
77e3df9
Merge pull request #11 from micronaut-projects/remove-max-heap-size
andriy-dmytruk Apr 8, 2024
cfa3747
Merge pull request #10 from micronaut-projects/use-id-double-quote
andriy-dmytruk Apr 8, 2024
92af672
fix docs
sdelamo Apr 9, 2024
f0f7d4f
remove controller
sdelamo Apr 9, 2024
1e5f546
add logback
sdelamo Apr 9, 2024
06706fa
suffix schema.json in id
sdelamo Apr 9, 2024
3a2af09
Merge pull request #15 from micronaut-projects/add-logback
andriy-dmytruk Apr 9, 2024
02a633c
Merge pull request #16 from micronaut-projects/init-id-schema-json
andriy-dmytruk Apr 9, 2024
b014c4f
Merge pull request #14 from micronaut-projects/remove-controller
andriy-dmytruk Apr 9, 2024
02ce616
annotate processor classes with @Internal
sdelamo Apr 10, 2024
9280bf2
use kotlin file
sdelamo Apr 10, 2024
98bba9e
JSON Schema Validation
sdelamo Apr 10, 2024
b2a9c2a
Merge pull request #18 from micronaut-projects/use-kotlin-file
andriy-dmytruk Apr 10, 2024
646916c
Merge pull request #19 from micronaut-projects/validator
andriy-dmytruk Apr 10, 2024
97483a5
Merge pull request #17 from micronaut-projects/annotate-with-internal
andriy-dmytruk Apr 10, 2024
4166e72
Add possibility to support multiple drafts in the future (#20)
andriy-dmytruk Apr 11, 2024
ea8f7cd
Implement review comments
andriy-dmytruk Apr 11, 2024
ea2c052
Extend Jackson support and add tests (#21)
andriy-dmytruk Apr 12, 2024
231b41e
Remove the JsonSchemaConfiguration in favor of changing the annotatio…
andriy-dmytruk Apr 16, 2024
bd1d8d0
Change visitor type to isolating
andriy-dmytruk Apr 16, 2024
ae9e774
Add back documentation changes
andriy-dmytruk Apr 16, 2024
7b6784b
Modify the JSON schema validator to not use mappings and only allow l…
andriy-dmytruk Apr 16, 2024
9978b6a
Modify annotation support and provide warnings for unsupported annota…
andriy-dmytruk Apr 18, 2024
48ac454
Fix tests
andriy-dmytruk Apr 18, 2024
25c8f87
Fix spotless
andriy-dmytruk Apr 18, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ plugins {
id 'io.micronaut.build.internal.json-schema-base'
id "io.micronaut.build.internal.module"
}

micronautBuild {
binaryCompatibility {
enabled.set(false)
}
}
3 changes: 3 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
<!-- files="DefaultBeanContext.java|BeanDefinitionWriter.java|DefaultHttpClient.java"/> -->

<suppress checks="MissingJavadocType" files=".*doc-examples.*" />
<suppress checks="MethodName" files=".*jsonschema.visitor.model.Schema.java" />
<suppress checks="ParameterName" files=".*jsonschema.visitor.model.Schema.java" />

</suppressions>
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
projectVersion=1.0.0-SNAPSHOT
projectGroup=io.micronaut.json-schema
projectGroup=io.micronaut.jsonschema

title=Micronaut json-schema
projectDesc=TODO
title=Micronaut JSON schema
projectDesc=JSON schema support for Micronaut
projectUrl=https://micronaut.io
githubSlug=micronaut-projects/micronaut-json-schema
developers=Graeme Rocher
developers=Andriy Dmytruk
org.gradle.caching=true
org.gradle.jvmargs=-Xmx1g
39 changes: 19 additions & 20 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,34 @@
# a managed version (a version which alias starts with "managed-"

[versions]
micronaut = "4.3.12"
micronaut = "4.4.0"
micronaut-docs = "2.0.0"
micronaut-logging = "1.2.3"
micronaut-serde = "2.9.0"
micronaut-test = "4.2.1"
micronaut-validation = "4.5.0"

groovy = "4.0.17"
managed-json-schema-validator = "1.4.0"
kotlin = "1.9.23"
ksp = "1.9.23-1.0.19"
spock = "2.3-groovy-4.0"

# Managed versions appear in the BOM
# managed-somelib = "1.0"
# managed-somebom = "1.1"

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

#
# Managed dependencies appear in the BOM
#
# managed-somelib = { module = "group:artifact", version.ref = "managed-somelib" }

#
# Imported BOMs, also appearing in the generated BOM
#
# boms-somebom = { module = "com.foo:somebom", version.ref = "managed-somebom" }

# Other libraries used by the project but non managed

# micronaut-bom = { module = "io.micronaut:micronaut-bom", version.ref = "micronaut" }
# jdoctor = { module = "me.champeau.jdoctor:jdoctor-core", version.ref="jdoctor" }
managed-json-schema-validator = { module = "com.networknt:json-schema-validator", version.ref = "managed-json-schema-validator" }

junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" }
[bundles]

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id 'io.micronaut.build.internal.json-schema-module'
}



test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.jsonschema;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

/**
* An annotation that signifies that json schema should be created for the object.
* The JSON schema will attempt to mimic the way this object would be serialized.
*
* @since 1.0.0
* @author Andriy Dmytruk
*/
@Target({ ElementType.TYPE, ElementType.FIELD })
public @interface JsonSchema {

/**
* The title of the JSON schema.
* By default, the class name will be used.
*
* @return The title
*/
String title() default "";

/**
* The description of the JSON schema.
* By default, javadoc of the object will be used.
*
* @return The description
*/
String description() default "";

/**
* The schema's relative or absolute URI.
* The default will create the URI based on class name and configured base URI.
*
* @return The URI
*/
String uri() default "";

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ plugins {
id 'io.micronaut.build.internal.json-schema-base'
id "io.micronaut.build.internal.bom"
}

micronautBuild {
binaryCompatibility {
enabled.set(false)
}
}

25 changes: 25 additions & 0 deletions json-schema-processor/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugins {
id("io.micronaut.build.internal.json-schema-module")
}

dependencies {
compileOnly(mn.micronaut.core.processor)

implementation(mn.micronaut.http)
api(projects.micronautJsonSchemaAnnotations)
api(mn.jackson.databind)

testImplementation(mnValidation.validation)
testImplementation(mn.micronaut.inject.kotlin.test)
testImplementation(mn.micronaut.inject.groovy.test)
testImplementation(mn.micronaut.inject.java.test)
testImplementation(mnLogging.logback.classic)
testImplementation(mnLogging.logback.core)
testImplementation(mnLogging.slf4j.api)
testImplementation(mnLogging.slf4j.simple)
}


test {
useJUnitPlatform()
}
Loading
Loading