Skip to content

Commit

Permalink
Allow URL(s) as source in jsonschema2pojo-gradle-plugin
Browse files Browse the repository at this point in the history
Closes #1010
  • Loading branch information
unkish committed Aug 10, 2023
1 parent 72050f6 commit e5227c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions jsonschema2pojo-gradle-plugin/example/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ dependencies {
}

jsonSchema2Pojo {
// omitting 'source' will force plugin to look for sources under ${project.sourceSets.main.output.resourcesDir}/json
source = [
'https://raw.githubusercontent.com/joelittlejohn/jsonschema2pojo/master/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/recursiveTreeNode.json',
file("src/main/resources/json")
]
targetPackage = 'example'
includeJsr303Annotations = true
propertyWordDelimiters = ['_'] as char[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class GenerateJsonSchemaJavaTask extends DefaultTask {
setTargetVersion configuration

inputs.property("configuration", configuration.toString())
inputs.files project.files(configuration.sourceFiles)
inputs.files project.files(configuration.source.findAll { 'file'.equals(it.protocol) })
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
package org.jsonschema2pojo.gradle

import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;

import java.lang.reflect.Field

import org.apache.commons.io.FileUtils
import org.gradle.tooling.BuildLauncher
import org.gradle.tooling.GradleConnector
import org.gradle.tooling.ProjectConnection
import org.jsonschema2pojo.gradle.JsonSchemaExtension
import org.junit.Test

class JsonSchemaPluginSpec {
Expand Down

0 comments on commit e5227c0

Please sign in to comment.