tniswong / domain-schemagen Goto Github PK
View Code? Open in Web Editor NEWA Grails Plugin to run schemagen on Groovy domain classes
License: Other
A Grails Plugin to run schemagen on Groovy domain classes
License: Other
The plugin does not work with enums and custom validators from the /src/groovy package.
I have set up a test project using this domain class:
package testdomainschemagen
import org.dom.test.Colors
import org.dom.test.CustomValidators
class Test {
Colors hair
static constraints = {
hair CustomValidators.notNullable
}
}
// This enum:
package org.dom.test
enum Colors {
BLACK, BLUE, WHITE, RED, YELLOW
}
// This custom validator
package org.dom.test
class CustomValidators {
/* This validator can be used for fields that shall be non-nullable in the application, but nullable in the database schema.
This is usually necessary when importing incomplete data
*/
static notNullable = { val ->
val ? true : 'validation.noValueGiven'
}
}
grails domain-schemagen --stacktrace produces the following:
..... "domain-schemagen --stacktrace"|Loading Grails 2.3.5
|Configuring classpath
.
|Environment set to development
........Error
.................
Error executing script DomainSchemagen: : Compilation Failed (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Users\bgathman\IdeaProjects\TestDomainSchemaGen\grails-app\domain\testdomainschemagen\Test.groovy: 4: unable to resolve class org.dom.test.CustomValidators
@ line 4, column 1.
import org.dom.test.CustomValidators
^
C:\Users\bgathman\IdeaProjects\TestDomainSchemaGen\grails-app\domain\testdomainschemagen\Test.groovy: 3: unable to resolve class org.dom.test.Colors
@ line 3, column 1.
import org.dom.test.Colors
^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.