Giter Club home page Giter Club logo

jaxb-facets's Introduction

JAXB-Facets

This is a fork of jaxb-facets from http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html

It aims to automate the creation of facets specific versions of the jaxb-api and jaxb-impl using maven.

A jaxb jira is outstanding to integrate this stuff directly into JAXB RI. If and when that happens this project will be obselete (which we are looking forward to!).

http://java.net/jira/browse/JAXB-917

Quick Summary

Jaxb-facets allows to define specialized annotations on schema Java classes and properties ...

package foo;
import java.util.List;
import javax.xml.bind.annotation.*;

@XmlType(name = "TestType")
@Annotation(id = "anno1", documentation = {
    @Documentation(value = "doc 1", lang = "en", source = "src 1"),
    @Documentation("doc 2")
})
@AppInfo(source = "src 2", value = "<custom xmlns=\"myns123\">Custom app info</custom>")
@Assert(id="assert1", test = "not(foo) or not(bar)")
public class TestType {
    @XmlAttribute
    @Facets(length = 100, pattern = "[a-z]+")
    @Documentation("<b>string attribute</b>")
    @AppInfo(source = "src 1", value = "<foo xmlns=\"myns123\">appinfo 1</foo>")
    private String foo;

    @XmlElement
    @MinOccurs(2)
    @MaxOccurs(10)
    @Facets(pattern = "[0-9]+")
    @Documentation("<b>list of strings</b>")
    private List<String> bar;

    //...
}

... and automatically generates corresponding XSD documents:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="testType">
    <xs:annotation id="anno1">
      <xs:appinfo source="src 2">
        <ns1:custom xmlns:ns1="myns123">Custom app info</ns1:custom>
      </xs:appinfo>
      <xs:documentation source="src 1" xml:lang="en">doc 1</xs:documentation>
      <xs:documentation>doc 2</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="bar" minOccurs="2" maxOccurs="10">
        <xs:annotation>
          <xs:documentation>
            <b>list of strings</b>
          </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:pattern value="[0-9]+"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="foo">
      <xs:annotation>
        <xs:appinfo source="src 1">
          <ns2:bar xmlns:ns2="myns123">appinfo 1</ns2:bar>
        </xs:appinfo>
        <xs:documentation>
          <b>string attribute</b>
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:length value="100"/>
          <xs:pattern value="[a-z]+"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:assert id="assert1" test="not(foo) or not(bar)"/>
  </xs:complexType>
</xs:schema>

You can generate schema files by running the following commands:

mvn install -DskipTests
./bin/schemagen.sh -d /tmp/output_directory/ -cp jaxb-impl/target/test-classes/:jaxb-api/target/classes/ path/to/your/code/TestType.java

The procedure also works in the other direction, generating Java source code from existing XSD schemas with facets and annotations. Currently this only works if the XSD schema is embedded into a WSDL file (see here for a minimum working example):

./bin/wsimport.sh -keep -B-jaxb-facets -d /tmp/output_directory path/to/your/code/tmpservice.wsdl

Maven Repository

The jaxb-api and jaxb-impl JARs are deployed to a maven repo located here:

https://github.com/whummer/mvn

E.g., see:

https://raw.github.com/whummer/jaxb-facets/master/releases/javax/xml/bind/jaxb-api/2.2.7-facets-1.0.5/jaxb-api-2.2.7-facets-1.0.5.jar https://raw.github.com/whummer/jaxb-facets/master/releases/com/sun/xml/bind/jaxb-impl/2.2.6-facets-1.3.1/jaxb-impl-2.2.6-facets-1.3.1.jar

Compile & Build

To compile, test and package the code, run a maven build from the project's root directory:

$ mvn clean install

Maven Integration

To integrate JAXB-Facets into your Maven project, simply add the following repository and dependencies. You need to ensure that there are no other versions of jaxb-api and jaxb-impl on the CLASSPATH.

<project ...>
...
    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.7-facets-1.0.5</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.6-facets-1.3.1</version>
        </dependency>
        ...
    </dependencies>

    <repositories>
        <repository>
            <id>github-repo-releases</id>
            <url>https://raw.github.com/whummer/jaxb-facets/master/releases</url>
        </repository>
    </repositories>
...
</project>

JAXB Schemagen Maven Integration

To integrate JAXB-Facets with the schemagen facility of jaxb2-maven-plugin, use the following configuration:

<project ...>
...
	<build>
		<plugins>
			<plugin>
	    		<groupId>org.codehaus.mojo</groupId>
	    		<artifactId>jaxb2-maven-plugin</artifactId>
	    		<version>1.5</version>
	    		<dependencies>
	    			<dependency>
	    				<groupId>com.sun.xml.bind</groupId>
	    				<artifactId>jaxb-impl</artifactId>
	    				<version>2.2.6-facets-1.3.1</version>
					</dependency>
					<dependency>
	    				<groupId>javax.xml.bind</groupId>
	        			<artifactId>jaxb-api</artifactId>
	        			<version>2.2.7-facets-1.0.5</version>
	    			</dependency> 
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-xjc</artifactId>
                        <version>2.2.6</version>
                        <exclusions>
                        	<exclusion>
			    				<groupId>javax.xml.bind</groupId>
			        			<artifactId>jaxb-api</artifactId>
                        	</exclusion>
                        	<exclusion>
			    				<groupId>com.sun.xml.bind</groupId>
			    				<artifactId>jaxb-impl</artifactId>
                        	</exclusion>
                        </exclusions>
                	</dependency>
				</dependencies>
				<executions>
	        		<execution>
	            		<goals>
	                		<goal>schemagen</goal>
	            		</goals>
	            		<phase>generate-resources</phase>
	            		<configuration>
	            			...
	            		</configuration>
	            	</execution>
	            </executions>
			</plugin>
		</plugins>
	</build>
...
</project>

Wsimport Integration (WSDL-First Schema Generation)

Starting with version 2.2.6-facets-1.1.0, JAXB-facets supports also WSDL-first generation using 'wsimport'. JAXB-Facets can easily be hooked as a plugin into wsimport in order to include the specific annotations (@Facets, @Documentation, @Annotation, ...) in the generated Java code.

To activate the plugin, use the wsimport wrapper script with the "-jaxb-facets" switch as follows:

./bin/wsimport.sh -keep -B-jaxb-facets -d <target_dir> <source_wsdl>

... and for Windows:

./bin/wsimport.bat -keep -B-jaxb-facets -Xendorsed -d <target_dir> <source_wsdl>

Maven Endorsed Integration

In some situations in order to make use of the new jaxb facet in your maven project, you may need to make use of the endorsed strategy with the maven compiler and surefire plugins.

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-dependency-plugin</artifactId>
	<configuration>
		<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
	</configuration>
	<executions>
		<execution>
			<id>copy-endorsed</id>
			<phase>generate-sources</phase>
			<goals>
				<goal>copy</goal>
			</goals>
			<configuration>
				<artifactItems>
					<artifactItem>
						<groupId>javax.xml.bind</groupId>
						<artifactId>jaxb-api</artifactId>
						<version>2.2.6-facets-1.0.5</version>
						<overWrite>true</overWrite>
						<destFileName>jaxb-api.jar</destFileName>
					</artifactItem>
				</artifactItems>
			</configuration>
		</execution>
	</executions>
</plugin>
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<configuration>
		<compilerArguments>
			<endorseddirs>${project.build.directory}/endorsed</endorseddirs>
		</compilerArguments>
	</configuration>
</plugin>
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-surefire-plugin</artifactId>
	<configuration>
		<systemPropertyVariables>
			<java.endorsed.dirs>${project.build.directory}/endorsed</java.endorsed.dirs>
		</systemPropertyVariables>
	</configuration>
</plugin>

Change Log

  • jaxb-impl:2.2.11-facets-1.4.0
    • upgrade to JAXB version 2.2.11. Should fix issues with spring boot 1.3.1 (see issue #29)
  • jaxb-impl:2.2.6-facets-1.3.1
    • fix support for command-line "schemagen" schema generation. Fix issue github.com//issues/23
  • jaxb-impl:2.2.6-facets-1.3.0
    • support for javax bean validation (JSR 303) constraints, which are now included in generated schema (integrated pull request #20).
  • jaxb-impl:2.2.6-facets-1.2.0
    • Initial support for xs:assert elements (defined in XML Schema 1.1).
    • Refactorings due to newly introduced XML Schema 1.1 features.
  • jaxb-api:2.2.7-facets-1.0.5
    • Added @Assert annotation to define xs:assert elements.
  • jaxb-impl:2.2.6-facets-1.1.0
    • Added support for "wsimport" WSDL-first JAXB generation.
  • jaxb-impl:2.2.6-facets-1.0.11
    • add location() parameter to @Annotation (INSIDE_ELEMENT, OUTSIDE_ELEMENT): For XSD groups (in particular ), this allows to place either inside the children of the group, or into the group itself (as sibling of the children of the group). This can also be used to place an annotation inside an @XmlElementWrapper, instead of placing it inside the element which is wrapped.
  • jaxb-api:2.2.7-facets-1.0.4
    • Added AnnotationLocation class to specify the location of generated XSD annotations.
  • jaxb-impl:2.2.6-facets-1.0.10
    • support jaxb-facets for source code based schemagen (e.g., used for "mvn generate-resources)
    • remaining limitation: package-level annotations do not (yet) work with the schemagen based generation approach. This is planned for a future release.
  • jaxb-impl:2.2.6-facets-1.0.9
    • support additional facets (e.g., maxLength) on enumeration types
  • jaxb-impl:2.2.6-facets-1.0.8
    • compulsory namespace for xsd:annotation attributes
    • improved schema validation in unit tests
  • jaxb-impl:2.2.6-facets-1.0.7
    • support for custom attributes in xsd:annotation
    • support for XML content in xsd:annotation
    • test classes moved back to jaxb-impl project
  • jaxb-api:2.2.7-facets-1.0.3
    • minor (changed versions, updated pom.xml file metadata)
  • jaxb-impl:2.2.7-facets-1.0.6
    • removed com.sun.xml.internal.* references
    • moved jaxb-impl test classes into separate maven project
    • code refactoring; removed code duplication in XmlSchemaGenerator
  • jaxb-impl:2.2.7-facets-1.0.5
    • fixed pom.xml metadata and JAR manifest info
    • Handling of com.sun.xml.internal.* classes in separate XmlSchemaGenerator
  • jaxb-impl:2.2.7-facets-1.0.4
    • test utility classes
    • updated CXF dependency version
  • jaxb-impl:2.2.7-facets-1.0.3
    • test cases for enum literals support
  • jaxb-api:2.2.7-facets-1.0.2
    • initial github version

Older versions (legacy from http://dsg.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html):

  • 2012-11-09: version 1.0 Minor bug fixes and API changes in @Facets. The type of minInclusive/maxInclusive/minExclusive/maxExclusive has been changed from long to String, which is needed, e.g., to represent min/max for dates. This version is not API compatible with 0.x versions!
  • 2012-09-05: version 0.4 Support for xsd:annotation, xsd:appinfo, and xsd:documentation
  • 2012-05-27: version 0.3 fixed classloading-related issues; ready for deployment in JBoss
  • 2012-04-15: version 0.2 supports Facets for XML attributes; support for Java 1.7
  • 2011-12-04: version 0.1 initial release

jaxb-facets's People

Contributors

pellcorp avatar vbence avatar whummer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jaxb-facets's Issues

Thread.dumpStack is being generated?

I am getting a repeated stack trace:

java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1249)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.getRestriction(XmlSchemaEnhancer.java:785)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.getRestriction(XmlSchemaEnhancer.java:776)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.addFacets(XmlSchemaEnhancer.java:103)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace$2.write(XmlSchemaGenerator.java:1177)
at com.sun.xml.bind.v2.schemagen.Tree$Optional.write(Tree.java:185)
at com.sun.xml.bind.v2.schemagen.Tree$Group.write(Tree.java:255)
at com.sun.xml.bind.v2.schemagen.Tree.write(Tree.java:138)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeClass(XmlSchemaGenerator.java:1034)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:721)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$800(XmlSchemaGenerator.java:519)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:501)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBContextImpl.java:832)
at org.apache.cxf.common.jaxb.JAXBUtils.generateJaxbSchemas(JAXBUtils.java:765)
at org.apache.cxf.jaxb.JAXBDataBinding.generateJaxbSchemas(JAXBDataBinding.java:439)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:362)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:478)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:540)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:252)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

I can see the code that causes it and I don't understand why it's there. I am going to provide a pull request to replace the Thread.dumpStack with a log statement, but would really like to understand why the code is even required.

Issue with @Facets and @XmlJavaTypeAdapter

A fragment of my entity:

private BigDecimal salary;

@XmlElement(name = "salary")
@javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter(com.pellcorp.jaxb.DecimalAdaptor.class)
@javax.xml.bind.annotation.Facets(minInclusive="1000.1", maxInclusive="9999.2")
public BigDecimal getSalary() {
    return salary;
}

Decimal Adaptor is:

public class DecimalAdaptor extends XmlAdapter<String, BigDecimal> {
@OverRide
public String marshal(BigDecimal value) throws Exception {
if (value == null) {
return null;
}

    return value.toPlainString();
}

@Override
public BigDecimal unmarshal(String value) throws Exception {
    if (value == null) {
        return null;
    }

    CharSequence trimmed = WhiteSpaceProcessor.trim(value);

    if (trimmed.length() == 0) {
        return null;
    }

    try {
        return new BigDecimal(trimmed.toString());
    } catch (NumberFormatException e) {
        throw new NumberFormatException("Invalid decimal");
    }
}

}

I get the following exception only where I am using the adaptor...

java.lang.RuntimeException: org.xml.sax.SAXParseException; cos-applicable-facets: Facet 'maxInclusive' is not allowed by type #AnonType_salaryPerson.
at com.pellcorp.jaxb.JaxbTest.getSchema(JaxbTest.java:172)
at com.pellcorp.jaxb.JaxbTest.setup(JaxbTest.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.xml.sax.SAXParseException; cos-applicable-facets: Facet 'maxInclusive' is not allowed by type #AnonType_salaryPerson.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:347)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4166)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4145)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractTraverser.reportSchemaError(XSDAbstractTraverser.java:721)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.getSimpleType(XSDSimpleTypeTraverser.java:406)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.traverseLocal(XSDSimpleTypeTraverser.java:147)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:397)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:194)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:3618)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:633)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:616)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:574)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:540)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:252)
at com.pellcorp.jaxb.JaxbTest.getSchema(JaxbTest.java:169)
... 16 more

@Pattern annotation does not work nicely with @XmlID and @XmlIDREF

Suppose you want to use the @pattern to generate a simpleType that is based on xs:ID or "xs:IDREF". The example below we define a Book that has an isb number with
both a @pattern and @xmlid annotations (that acts as a xs:ID). We have a Loan that references a Book and thus references it via the isb number that also has the same @pattern annotation but @XMLRef (via a xs:IDREF). The @pattern annotation does not play very nicely:

  1. When @pattern is used with @xmlid the @pattern is completely ignored (book example)
  2. When @pattern is used with @XmlIDREF the @XmlIDREF is ignored and the base is xs:string instead of xs:IDREF (loan example).
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
public class Library {
    @XmlElementWrapper(name = "loans")
    @XmlElement(name = "loan")
    private List<Loan> loans;

    @XmlElementWrapper(name = "books")
    @XmlElement(name = "book")
    private List<Book> books;

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Book {
        @XmlID
        @XmlAttribute(required = true)
        @Pattern(regexp = ISB_REGEX)
        private String isbn;
    }

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Loan {
        @XmlIDREF
        @XmlAttribute(required = true)
        @Pattern(regexp = ISB_REGEX)
        private Book book;
    }

    private static final String ISB_REGEX = "ISB-(\\d{3})-\\d-(\\d{2})-(\\d{6})-\\1";
}

The generated schema is:

  <xs:element name="library" type="library"/>

  <xs:complexType name="library">
    <xs:sequence>
      <xs:element minOccurs="0" name="loans">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="loan" type="loan"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" name="books">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="book" type="book"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="loan">
    <xs:sequence/>
    <xs:attribute name="book" type="xs:IDREF" use="required"/>
  </xs:complexType>

  <xs:complexType name="book">
    <xs:sequence/>
    <xs:attribute name="isbn" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:pattern value="ISB-(\d{3})-\d-(\d{2})-(\d{6})-\1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

but it should be:

  <xs:element name="library" type="library"/>

  <xs:complexType name="library">
    <xs:sequence>
      <xs:element minOccurs="0" name="loans">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="loan" type="loan"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" name="books">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="book" type="book"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="loan">
    <xs:sequence/>
    <xs:attribute name="isbn" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:IDREF">
          <xs:pattern value="ISB-(\d{3})-\d-(\d{2})-(\d{6})-\1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="book">
    <xs:sequence/>
    <xs:attribute name="isbn" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:ID">
          <xs:pattern value="ISB-(\d{3})-\d-(\d{2})-(\d{6})-\1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

javax.validation.UnexpectedTypeException when using @Facets to other types except String

The @facets has as validator FacetsValidator which expects a String as the type to validate.

When an Integer or BigDecimal is annotated with @facets annotation and try to persist a JPA entity with hibernate I get the following exception

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.math.BigDecimal.
at org.hibernate.validator.internal.engine.ConstraintTree.verifyResolveWasUnique(ConstraintTree.java:411)
at org.hibernate.validator.internal.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:392)
at org.hibernate.validator.internal.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:350)
at org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:171)
at org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:124)
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:86)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:442)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:387)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:351)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:303)
at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:133)
at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:136)
at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreInsert(BeanValidationEventListener.java:94)
at org.hibernate.action.internal.EntityInsertAction.preInsert(EntityInsertAction.java:181)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:81)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:369)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:286)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:996)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:241)
at com.sun.proxy.$Proxy82.flush(Unknown Source)

wsimport issue

Hi,

First, Thanks for the great word. I'm just trying to use wsimport feature but gettng below error:

C:\Users\Admin\Desktop\NF\KAS2.0_wsdl>C:\Users\Admin\Desktop\jaxws-ri\bin\wsimpo
rt.bat -keep -B-jaxb-facets odemeAl.wsdl -b b1.xml -Xendorsed
Exception in thread "main" java.util.ServiceConfigurationError: com.sun.tools.xj
c.Plugin: Provider at.ac.tuwien.infosys.jaxb.WsImportFacetsPlugin not a subtype
        at java.util.ServiceLoader.fail(ServiceLoader.java:214)
        at java.util.ServiceLoader.access$300(ServiceLoader.java:164)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:352)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:428)
        at com.sun.tools.xjc.Options.findServices(Options.java:957)
        at com.sun.tools.xjc.Options.getAllPlugins(Options.java:374)
        at com.sun.tools.xjc.Options.parseArgument(Options.java:688)
        at com.sun.tools.ws.wscompile.WsimportOptions.parseArguments(WsimportOpt
ions.java:353)
        at com.sun.tools.ws.wscompile.WsimportOptions.parseArguments(WsimportOpt
ions.java:249)
        at com.sun.tools.ws.wscompile.WsimportTool.parseArguments(WsimportTool.j
ava:379)
        at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:202)
        at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.ws.Invoker.invoke(Invoker.java:174)
        at com.sun.tools.ws.WsImport.main(WsImport.java:57)

I'm usign the jar files on the main gitHub pages, as you see -jaxbFacets option is recognized, I also put jst308 to the classpath.

Maven plugin classloader issue with annotations

When using the latest source from github I get the following exception thrown. This occurs when using java 6 AND java 7 with Maven 3. I will try and come up with a reproducible test case for this issue.

Caused by: java.lang.IllegalArgumentException: interface javax.xml.bind.annotation.Annotation is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.getXsdAnnotationAnnotation(XmlSchemaEnhancer.java:496)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.getXsdAnnotationAnnotation(XmlSchemaEnhancer.java:402)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.hasXsdAnnotations(XmlSchemaEnhancer.java:307)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.addXsdAnnotations(XmlSchemaEnhancer.java:168)
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.addXsdAnnotations(XmlSchemaEnhancer.java:195)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:688)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$800(XmlSchemaGenerator.java:519)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:501)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBContextImpl.java:832)
at org.apache.cxf.common.jaxb.JAXBUtils.generateJaxbSchemas(JAXBUtils.java:765)
at org.apache.cxf.jaxb.JAXBDataBinding.generateJaxbSchemas(JAXBDataBinding.java:439)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:362)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:478)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:540)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:252)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)

Can you provide some help on integrating facets to jboss as 7

Due to different class loader it seems that endorsement of jars does not work well and I cannot make this work with as7. Are you able to provide some help?

I follow the issue jaxb-917 and I see hibernate validator is implemented with custom validator som IMO it should work, just dont know how to push it to this particular application server.

tnx

Annotation generation

If it is possible to somehow generate Java classes with @appinfo annotation out of the xsd or wsdl file that containts these annotations? I tried to generate Java classes using the test.wsdl file from your repository but got classes only with @document annotation over a class structure.
Sorry if it is not a proper issue. Thanks in advance.

Version in pom.xml of jaxb-facets

Version in pom.xml if jaxb-facets changed to 2.2.7-facets-1.0.10 but the parent version in jaxb-api, jaxb-impl and testutils refers to version 2.2.7-facets-1.0.1. The project is not building correctly to the latest version because it read the old properties from the previous pom.xml of jaxb-facets.

I think the submodules should be updated to have the latest version of jaxb-facets module in parent tags.

Classes in jaxb-api-2.2.7.jar should be included in the jaxb-api-2.2.7-facets-1.0.2.jar.

The jaxb-api classes are not extracted in target/classes and the jar file with the facets extension does not include the other jaxb-api classes.

This causes a problem especially when you want to use this library with Maven on Java 1.6. If you want maven to use the newest jaxb-api jar file and copy the file in an endorsed directory this will not work because Maven complains you specify as dependencies the same groupId and artifactId with twice with different versions.

Also, because jaxb-api.jar is the MANIFEST.MF file of jaxb-impl it needs to be renamed as jaxb-api.jar. This cannot be achieved if you have to add both versions in the endorsed directory.

AnnotationLocation missing

I am using the latest version (2.2.6-facets-1.0.11) and I am trying the generate a WSDL and the XSDs interface using wsgen. I followed the instructions to include the jaxb-facets in maven (using jdk 1.6), however, when I am generating the WSDL, I get the following error:
[INFO] Failed to execute wsgen

Embedded error: javax/xml/bind/annotation/AnnotationLocation
javax.xml.bind.annotation.AnnotationLocation

I looked into the api source code and I saw the AnnotationLocation, however, it does not seem to be present in the packaged JAR.
I tried to rebuild the JAR from the source code but I got missing dependencies:

Reason: Cannot find parent: at.ac.tuwien.infosys:jaxb-facets for project: com.pellcorp.jaxb-facets:testutils:jar:0.2 for project com.pellcorp.jaxb-facets:testutils:jar:0.2

Could you check the JAR and rebuild it so that it would contain the AnnotationLocation ?

Thanks in advance,
Cedric

Jaxb-Facets @MaxOccurs generated XML Schema validation not working

In Jaxb-Facets
Given @MaxOccurs(2) for java collection datatype

@MaxOccurs(2)
List testList;

But if we give more than 2 data in SOAP UI for testing, operation runs successfully without returning a fault message "Maximum 2 data can be given"

No Schema Validation happening

@Facets does not support jxc schemagen

In our project we use the jaxb2-maven-plugin in order to generate schema files from java classes at designtime. The plugin uses the com.sun.tools.jxc.SchemaGenerator class (schemagen) for schema generation. It seems so that this approach is not supported by jaxb-facets.

We configured the plugin with the jaxb-facets dependencies in the pom as follows:
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.6-facets-1.0.9</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7-facets-1.0.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.6</version>
</dependency>
</dependencies>
...

This will override the original plugin dependencies (jaxb 1.1,13) with jaxb 2.2.6 and adds the @facets dependencies. If we start the schema generation process with maven, the following error occures:

An annotation processor threw an uncaught exception.
Consult the following stack trace for details.java.lang.ClassCastException: com.sun.tools.javac.code.Type$ClassType cannot be cast to java.lang.Class
at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.addXsdAnnotations(XmlSchemaEnhancer.java:188)
at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:688)
...

Spring boot 1.3.1 + jaxb-facets

Old conf without problem:

I have a project using spring-boot 1.2.4
For managing web services inside it, I'm using apache.cxf. 2.7.11

pom.xml :

<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-rt-frontend-jaxws</artifactId>
  <version>${cxf.version}</version>
  <exclusions>
    <exclusion>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
    </exclusion>
    <exclusion>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-rt-transports-http</artifactId>
  <version>${cxf.version}</version>
</dependency>

<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.2.7-facets-1.0.5</version>
</dependency>
<dependency>
  <groupId>com.sun.xml.bind</groupId>
  <artifactId>jaxb-impl</artifactId>
  <version>2.2.6-facets-1.3.1</version>
</dependency>

New conf (with problem)

I tried to move to spring boot 1.2.4 -> 1.3.1.
Which let to an incompatibility with my current apache.cxf dependency. 2.7.11 -> 3.1.4
(May have been a bad idea)

The problem is this one uses com.sun.xml.bind:jaxb-core:2.2.11
Which seems incompatible with com.sun.xml.bind:jaxb-imp:2.2.6-facets-1.3.1

During mvn install, the following error :

Caused by: java.lang.NoSuchFieldError: REFLECTION
    at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:93)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:455)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:303)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:142)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1174)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:162)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:247)

If I try to keep apache.cxf in version 2.7.xx

I get this error :

Caused by: java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.isCglibProxyClass(Ljava/lang/Class;)Z
    at org.apache.cxf.common.util.SpringAopClassHelper.getRealClassInternal(SpringAopClassHelper.java:85)
    at org.apache.cxf.common.util.ClassHelper.getRealClass(ClassHelper.java:65)
    at org.apache.cxf.jaxws.EndpointImpl.getImplementorClass(EndpointImpl.java:215)

It would be really useful for me to migrate to spring boot 1.3.1 since they include Linux service integration.
I would be a shame to have to remove Jaxb-facets for doing that.

Pushing facets support upstream

As we know up streaming of jaxb-facets didn't happen even though we went through the procedure couple of times. That said, with the JDK going through simplification and splitting up of JEE to Jakarta and moving under the eclipse umbrella perhaps there's some headroom to try again?
The repository is here https://github.com/eclipse-ee4j/jaxb-ri, shall we give it another go?

mvn clean install with empty repository

My version:

$ uname -a
Linux nilspc 3.13.0-46-generic #75-Ubuntu SMP Tue Feb 10 15:24:04 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ mvn -v
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.7.0_75/jre
Default locale: pt_BR, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-46-generic", arch: "amd64", family: "unix"

with empty $HOME/.m2/repository

$ mvn clean compile

some errors to get dependencys, fixed testutils/pom.xml b/testutils/pom.xml

diff --git a/testutils/pom.xml b/testutils/pom.xml
index 25f45bd..0397d90 100644
--- a/testutils/pom.xml
+++ b/testutils/pom.xml
@@ -4,11 +4,18 @@
     <artifactId>testutils</artifactId>
     <version>0.3</version>

-   <parent>
+   <properties>
+                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+                <maven.compiler.source>1.6</maven.compiler.source>
+                <maven.compiler.target>1.6</maven.compiler.target>
+   </properties>
+
+
+       <parent>
          <groupId>at.ac.tuwien.infosys</groupId>
         <artifactId>jaxb-facets</artifactId>
         <version>2.2.7-facets-1.3.0</version>
-    </parent>
+        </parent>

     <dependencies>
         <dependency>
@@ -56,7 +63,7 @@
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
-           <version>2.11.0-beta-140301</version>
+           <version>2.11.0</version>
        </dependency>

        <dependency>
@@ -128,4 +135,16 @@
            <version>2.0.2</version>
        </dependency>
     </dependencies>
+
+         <repositories>
+                <repository>
+                        <id>github-repo-releases</id>
+                        <url>https://raw.github.com/whummer/jaxb-facets/master/releases</url>
+                </repository>
+            <repository>
+                <id>infosys-repo-releases</id>
+                <url>http://www.infosys.tuwien.ac.at/mvn</url>
+            </repository>
+        </repositories>
+
 </project>

$ mvn clean test
fail on testValidateGeneratedXsd. I don't know what to do... so i commented the test

diff --git a/jaxb-impl/src/test/java/at/ac/tuwien/infosys/jaxb/SchemaValidationTest.java b/jaxb-impl/src/test/java/
index eb82911..e14e5b6 100644
--- a/jaxb-impl/src/test/java/at/ac/tuwien/infosys/jaxb/SchemaValidationTest.java
+++ b/jaxb-impl/src/test/java/at/ac/tuwien/infosys/jaxb/SchemaValidationTest.java
@@ -33,7 +33,7 @@ public class SchemaValidationTest extends AbstractTestCase {

         cleanupServers();
     }
-
+/*
     @Test
     public void testValidateGeneratedXsd() throws Exception {
         String xml = getWsdlSchemaAsString(PersonService.class);
@@ -52,5 +52,5 @@ public class SchemaValidationTest extends AbstractTestCase {
             fail("Schema parsing error. See stack trace for details.");
         }
     }
-
+*/
 }

$mvn clean install
runs ok.

created a project just like this: #23 changing the version 2.2.6-facets-1.3.0 to 2.2.6-facets-1.3.1

$ mvn clean compile
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building jaxb-facets-sandbox 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jaxb-facets-sandbox ---
[INFO] Deleting /home/nils/workspaces/j2ee/jaxb-facets-sandbox/target
[INFO] 
[INFO] --- jaxb2-maven-plugin:1.6:schemagen (schemagen) @ jaxb-facets-sandbox ---
Fev 25, 2015 2:56:57 PM at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer writeCustomOccurs
ADVERTÊNCIA: Unable to get @MinOccurs annotation from type com.sun.xml.bind.v2.model.impl.TypeRefImpl@2199a025
java.lang.RuntimeException: Unexpected type of property parent: jaxb.factets.sandbox.Boo
    at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.getAnnotationOfProperty(XmlSchemaEnhancer.java:955)
    at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.writeCustomOccurs(XmlSchemaEnhancer.java:499)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace$2.write(XmlSchemaGenerator.java:1178)
    at com.sun.xml.bind.v2.schemagen.TreeWrapper.write(TreeWrapper.java:90)
    at com.sun.xml.bind.v2.schemagen.Tree$Group.write(Tree.java:255)
    at com.sun.xml.bind.v2.schemagen.Tree.write(Tree.java:138)
    at com.sun.xml.bind.v2.schemagen.Tree.write(Tree.java:141)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeClass(XmlSchemaGenerator.java:1039)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:721)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$800(XmlSchemaGenerator.java:519)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:501)
    at com.sun.tools.xjc.api.impl.j2s.JAXBModelImpl.generateSchema(JAXBModelImpl.java:183)
    at com.sun.tools.jxc.ap.SchemaGenerator.process(SchemaGenerator.java:115)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
    at com.sun.tools.javac.main.Main.compile(Main.java:439)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
    at com.sun.tools.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:240)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:171)
    at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:86)
    at org.codehaus.mojo.jaxb2.AbstractSchemagenMojo.execute(AbstractSchemagenMojo.java:215)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ jaxb-facets-sandbox ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jaxb-facets-sandbox ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/nils/workspaces/j2ee/jaxb-facets-sandbox/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.048s
[INFO] Finished at: Wed Feb 25 14:56:58 AMT 2015
[INFO] Final Memory: 16M/157M
[INFO] ------------------------------------------------------------------------

and the output is missing the @MinOccurs:
target/generated-resources/schemagen/schema1.xsd

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="jaxb-sandbox" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="boo">
    <xs:sequence>
      <xs:element name="someNumber">
        <xs:simpleType>
          <xs:restriction base="xs:int"/>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

I will try with older versions, then comment here.

xs:annotation cannot have attributes

According the Eclipse validator the xs:annotation now being generated in test case for Person is illegal. It certainly also breaks the CXF validation test as well (SchemaValidationTest)

Disabling the attributes in the Person class allows the SchemaValidationTest to pass again and Eclipse no longer complains about the XSD.

I cannot find any examples of using custom attributes on the xsd:annotation, not even the XSD Schema Primer provides such examples.

WARNING: Unable to get @MinOccurs annotation from type com.sun.xml.bind.v2.model.impl.TypeRefImpl@667de82c

Hello,

I am using the jaxb2-maven-plugin to generate XML Schema from annotated Java classes. Everything seems to work fine so far, except that I get tons of warnings in the Maven logs during the build.

The Java class:

package jaxb.factets.sandbox;

import javax.xml.bind.annotation.Facets;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

@XmlType(namespace="jaxb-sandbox")
@XmlAccessorType(XmlAccessType.FIELD)
public class Boo {

    @Facets(minInclusive="100")
    int someNumber;

}

The pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>jaxb-facets</groupId>
    <artifactId>jaxb-facets-sandbox</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>7</source>
                    <target>7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>1.6</version>
                <dependencies>
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-impl</artifactId>
                        <version>2.2.6-facets-1.3.0</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>2.2.7-facets-1.0.5</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-xjc</artifactId>
                        <version>2.2.6</version>
                        <exclusions>
                            <exclusion>
                                <groupId>javax.xml.bind</groupId>
                                <artifactId>jaxb-api</artifactId>
                            </exclusion>
                            <exclusion>
                                <groupId>com.sun.xml.bind</groupId>
                                <artifactId>jaxb-impl</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>schemagen</id>
                        <goals>
                            <goal>schemagen</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/*.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.7-facets-1.0.5</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>github-repo-releases</id>
            <url>https://raw.github.com/whummer/jaxb-facets/master/releases</url>
        </repository>
    </repositories>

</project>

The output log:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building jaxb-facets-sandbox 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jaxb-facets-sandbox ---
[INFO] 
[INFO] --- jaxb2-maven-plugin:1.6:schemagen (schemagen) @ jaxb-facets-sandbox ---
Jan 09, 2015 5:34:12 PM at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer writeCustomOccurs
WARNING: Unable to get @MinOccurs annotation from type com.sun.xml.bind.v2.model.impl.TypeRefImpl@667de82c
java.lang.ClassCastException: com.sun.tools.javac.code.Type$ClassType cannot be cast to java.lang.Class
    at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.getAnnotationOfProperty(XmlSchemaEnhancer.java:908)
    at at.ac.tuwien.infosys.jaxb.XmlSchemaEnhancer.writeCustomOccurs(XmlSchemaEnhancer.java:466)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace$2.write(XmlSchemaGenerator.java:1178)
    at com.sun.xml.bind.v2.schemagen.TreeWrapper.write(TreeWrapper.java:90)
    at com.sun.xml.bind.v2.schemagen.Tree$Group.write(Tree.java:255)
    at com.sun.xml.bind.v2.schemagen.Tree.write(Tree.java:138)
    at com.sun.xml.bind.v2.schemagen.Tree.write(Tree.java:141)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeClass(XmlSchemaGenerator.java:1039)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:721)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$800(XmlSchemaGenerator.java:519)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:501)
    at com.sun.tools.xjc.api.impl.j2s.JAXBModelImpl.generateSchema(JAXBModelImpl.java:183)
    at com.sun.tools.jxc.ap.SchemaGenerator.process(SchemaGenerator.java:115)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
    at com.sun.tools.javac.main.Main.compile(Main.java:439)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
    at com.sun.tools.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:240)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:171)
    at com.sun.tools.jxc.SchemaGenerator.run(SchemaGenerator.java:86)
    at org.codehaus.mojo.jaxb2.AbstractSchemagenMojo.execute(AbstractSchemagenMojo.java:215)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jaxb-facets-sandbox ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jaxb-facets-sandbox ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\dev\grails\ws\jaxb-facets-sandbox\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ jaxb-facets-sandbox ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ jaxb-facets-sandbox ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ jaxb-facets-sandbox ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jaxb-facets-sandbox ---
[INFO] Building jar: D:\dev\grails\ws\jaxb-facets-sandbox\target\jaxb-facets-sandbox-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ jaxb-facets-sandbox ---
[INFO] Installing D:\dev\grails\ws\jaxb-facets-sandbox\target\jaxb-facets-sandbox-0.0.1-SNAPSHOT.jar to C:\Users\pappmar\.m2\repository\jaxb-facets\jaxb-facets-sandbox\0.0.1-SNAPSHOT\jaxb-facets-sandbox-0.0.1-SNAPSHOT.jar
[INFO] Installing D:\dev\grails\ws\jaxb-facets-sandbox\pom.xml to C:\Users\pappmar\.m2\repository\jaxb-facets\jaxb-facets-sandbox\0.0.1-SNAPSHOT\jaxb-facets-sandbox-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.218 s
[INFO] Finished at: 2015-01-09T17:34:13+00:00
[INFO] Final Memory: 20M/226M
[INFO] ------------------------------------------------------------------------

The number of log messages depends on the number of domain classes.

The generated XML schema is fine:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="jaxb-sandbox" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="boo">
    <xs:sequence>
      <xs:element name="someNumber">
        <xs:simpleType>
          <xs:restriction base="xs:int">
            <xs:minInclusive value="100"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

It is not a blocking issue, I would just like to get rid of the warnings in the build logs. Is that possible?

Regards,
Marton

Using @Documentation annotation at field level causes @XmlSchemaType to be ignored

The @Documentation annotation causes some other annotations to be ignored when generating a schema from a model (via schemagen).

For example the following class that has a type of "xs:time" for both the from and to attributes. When the @Documentation is present on the from attribute it completely ignores the @XmlSchemaType(name = "time") annotation.

@XmlAccessorType(XmlAccessType.FIELD)
public class SimpleDuration {
    @XmlAttribute(required = true)
    @XmlSchemaType(name = "time")
    @Documentation("the opening time")
    private String from;

    @XmlAttribute(required = true)
    @XmlSchemaType(name = "time")
    private String to;

    public String getFrom() {
        return from;
    }

    public String getTo() {
        return to;
    }
}

generates:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="simpleDuration">
    <xs:sequence/>
    <xs:attribute name="from" use="required">
      <xs:annotation>
        <xs:documentation>the opening time</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="to" type="xs:time" use="required"/>
  </xs:complexType>
</xs:schema>

but should generate:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="simpleDuration">
    <xs:sequence/>
    <xs:attribute name="from"  type="xs:time"  use="required">
      <xs:annotation>
        <xs:documentation>the opening time</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="to" type="xs:time" use="required"/>
  </xs:complexType>
</xs:schema>

Preserve annotations during schema creation

Hi,

as far as I understand, the JAXB-Annotations are used to control aspects of the schema creation, e.g. type mapping or namespace binding. Therefore, these kind of Java annotations are not stored in the schema, and will not be reconstructed when generating a Java class from the schema.

For my application, I would like to define some types in JAXB Scheme, and generate Java classes out of it, including third party annotations. Is there any way to store non-JAXB Java annotations in an JAXB Schema file, and have xjc create the classes accordingly?

Which license

Hi whummer,

it is not really an issue, but can you tell me under which license the software is published?
Are we allowed to use it anywhere?

@Facets does not work on enum classes

Adding @facets annotation on an enum does not generate the restrictions on xsd files.

Example

@XmlEnum
@facets(maxLength = 20)
public enum Gender {
MALE,
FEMALE;
}

Desired output
<xs:simpleType name="Gender">
<xs:restriction base="xs:string">
<xs:enumeration value="MALE"/>
<xs:enumeration value="FEMALE"/>
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>

compilation fails because of testutils pom

testutils has a parent pom that is not part of the project :

at.ac.tuwien.infosys
jaxb-facets
2.2.7-facets-1.0.1

where the actual parent pom is on version 2.2.7-facets-1.0.11
setting the parent pom to this very version solved the issue

Support for JavaEE annotations

These bean validation constraints (javax.validation.constraint.*) could work as defaults where not overriden by @Facet annotations.

The most frequently used annotations like @Size(min = 2, max = 14) or @Max(1000) can be easily translated into the Facet world.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.