Skip to content

Commit

Permalink
Merge pull request #8 from micronaut-projects/andriy/init
Browse files Browse the repository at this point in the history
Create an initial version of the JSON schema processors
  • Loading branch information
andriy-dmytruk committed Apr 23, 2024
2 parents d847db2 + 25c8f87 commit 54368ee
Show file tree
Hide file tree
Showing 90 changed files with 4,827 additions and 31 deletions.
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()
}

0 comments on commit 54368ee

Please sign in to comment.