├── jsonschema2pojo-core
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── schema
│ │ │ │ ├── required.json
│ │ │ │ ├── enum.json
│ │ │ │ ├── embeddedRef.json
│ │ │ │ ├── parent.json
│ │ │ │ ├── child.json
│ │ │ │ ├── address.json
│ │ │ │ └── array.json
│ │ │ ├── wiremock
│ │ │ │ └── mappings
│ │ │ │ │ ├── address500.json
│ │ │ │ │ ├── address404.json
│ │ │ │ │ └── address.json
│ │ │ └── example-json
│ │ │ │ └── user.json
│ │ └── java
│ │ │ └── org
│ │ │ └── jsonschema2pojo
│ │ │ └── util
│ │ │ └── MakeUniqueClassNameTest.java
│ └── main
│ │ └── java
│ │ └── org
│ │ └── jsonschema2pojo
│ │ ├── Language.java
│ │ ├── exception
│ │ ├── package-info.java
│ │ └── GenerationException.java
│ │ ├── rules
│ │ ├── package-info.java
│ │ ├── JavaNameRule.java
│ │ └── ValidRule.java
│ │ ├── NoopAnnotator.java
│ │ ├── AllFileFilter.java
│ │ ├── util
│ │ ├── Models.java
│ │ └── LanguageFeatures.java
│ │ └── URLProtocol.java
└── NOTICE
├── jsonschema2pojo-gradle-plugin
├── example
│ ├── android
│ │ ├── app
│ │ │ ├── .gitignore
│ │ │ ├── src
│ │ │ │ ├── main
│ │ │ │ │ ├── res
│ │ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── values
│ │ │ │ │ │ │ ├── strings.xml
│ │ │ │ │ │ │ ├── styles.xml
│ │ │ │ │ │ │ └── dimens.xml
│ │ │ │ │ │ ├── values-w820dp
│ │ │ │ │ │ │ └── dimens.xml
│ │ │ │ │ │ ├── menu
│ │ │ │ │ │ │ └── menu_main.xml
│ │ │ │ │ │ └── layout
│ │ │ │ │ │ │ └── activity_main.xml
│ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ └── androidTest
│ │ │ │ │ └── java
│ │ │ │ │ └── jsonschema2pojo
│ │ │ │ │ └── joelittlejohn
│ │ │ │ │ └── github
│ │ │ │ │ └── com
│ │ │ │ │ └── androidexample
│ │ │ │ │ └── ApplicationTest.java
│ │ │ └── proguard-rules.pro
│ │ ├── lib
│ │ │ ├── .gitignore
│ │ │ ├── src
│ │ │ │ └── main
│ │ │ │ │ ├── AndroidManifest.xml
│ │ │ │ │ └── java
│ │ │ │ │ └── jsonschema2pojo
│ │ │ │ │ └── joelittlejohn
│ │ │ │ │ └── github
│ │ │ │ │ └── com
│ │ │ │ │ └── androidlibexample
│ │ │ │ │ └── AndroidLibExample.java
│ │ │ └── proguard-rules.pro
│ │ ├── settings.gradle
│ │ ├── .gitignore
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── README.md
│ │ ├── build.gradle
│ │ └── gradle.properties
│ └── java
│ │ ├── settings.gradle
│ │ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ ├── src
│ │ └── main
│ │ │ └── resources
│ │ │ └── json
│ │ │ ├── external_dependencies.json
│ │ │ └── address.json
│ │ └── build.gradle
├── src
│ ├── main
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── gradle-plugins
│ │ │ └── jsonschema2pojo.properties
│ └── test
│ │ └── groovy
│ │ └── org
│ │ └── jsonschema2pojo
│ │ └── gradle
│ │ └── JsonSchemaPluginSpec.groovy
└── NOTICE
├── jsonschema2pojo-integration-tests
├── src
│ └── test
│ │ ├── resources
│ │ ├── yaml
│ │ │ ├── comments.yaml
│ │ │ ├── arrayAsRoot.yaml
│ │ │ ├── simpleTypeAsRoot.yaml
│ │ │ ├── simplePropertiesInArrayItem.yaml
│ │ │ ├── array.yaml
│ │ │ ├── simpleTypes.yaml
│ │ │ ├── complexObject.yaml
│ │ │ ├── complexPropertiesInArrayItem.yaml
│ │ │ └── examples
│ │ │ │ └── torrent.yaml
│ │ ├── json
│ │ │ ├── simpleTypeAsRoot.json
│ │ │ ├── arrayAsRoot.json
│ │ │ ├── comments.json
│ │ │ ├── simplePropertiesInArrayItem.json
│ │ │ ├── simpleTypes.json
│ │ │ ├── array.json
│ │ │ ├── complexObject.json
│ │ │ ├── complexPropertiesInArrayItem.json
│ │ │ └── examples
│ │ │ │ └── torrent.json
│ │ ├── schema
│ │ │ ├── extends
│ │ │ │ ├── a.json
│ │ │ │ ├── extendsString.json
│ │ │ │ ├── subtypeOfBWithNoProperties.json
│ │ │ │ ├── b.json
│ │ │ │ ├── subtypeOfA.json
│ │ │ │ ├── c.json
│ │ │ │ ├── subtypeOfB.json
│ │ │ │ ├── subtypeOfSubtypeOfB.json
│ │ │ │ ├── subtypeOfSubtypeOfBDifferentType.json
│ │ │ │ ├── subtypeOfC.json
│ │ │ │ ├── subtypeOfSubtypeOfA.json
│ │ │ │ ├── subtypeOfSubtypeOfC.json
│ │ │ │ ├── extendsEmbeddedSchema.json
│ │ │ │ └── extendsSchemaWithinDefinitions.json
│ │ │ ├── regression
│ │ │ │ ├── foo.baz.json
│ │ │ │ ├── spaces in path.json
│ │ │ │ ├── underscores.json
│ │ │ │ ├── extendedCharacters.json
│ │ │ │ └── extends
│ │ │ │ │ ├── SimpleMessage.schema.json
│ │ │ │ │ └── AuthMessage.schema.json
│ │ │ ├── filtering
│ │ │ │ ├── README.md
│ │ │ │ ├── .svn
│ │ │ │ │ └── svn.json
│ │ │ │ ├── included.json
│ │ │ │ ├── sub
│ │ │ │ │ ├── sub.json
│ │ │ │ │ ├── .svn
│ │ │ │ │ │ └── sub.json
│ │ │ │ │ └── sub2
│ │ │ │ │ │ ├── sub.json
│ │ │ │ │ │ └── .svn
│ │ │ │ │ │ └── sub.json
│ │ │ │ └── excluded.json
│ │ │ ├── comments
│ │ │ │ └── comments.json
│ │ │ ├── typeInfo
│ │ │ │ ├── typeInfo.json
│ │ │ │ └── typeInfoWithSchemaProperty.json
│ │ │ ├── additionalProperties
│ │ │ │ ├── defaultAdditionalProperties.json
│ │ │ │ ├── noAdditionalProperties.json
│ │ │ │ ├── additionalPropertiesObject.json
│ │ │ │ ├── additionalPropertiesString.json
│ │ │ │ ├── additionalPropertiesPrimitiveBoolean.json
│ │ │ │ └── additionalPropertiesArraysOfStrings.json
│ │ │ ├── enum
│ │ │ │ ├── enumWithEmptyString.json
│ │ │ │ ├── enumWithNullValue.json
│ │ │ │ ├── enumWithExtendedCharacters.json
│ │ │ │ ├── enumWithNoValidCharactersForIdentifier.json
│ │ │ │ ├── enumWithTitle.json
│ │ │ │ ├── enumAsRoot.json
│ │ │ │ ├── enumWithUppercaseProperty.json
│ │ │ │ ├── integerEnumAsRoot.json
│ │ │ │ ├── doubleEnumAsRoot.json
│ │ │ │ ├── typeWithEnumProperty.json
│ │ │ │ ├── enumWithCustomJavaNames.json
│ │ │ │ ├── integerEnumToSerialize.json
│ │ │ │ └── multipleEnumArraysWithSameName.json
│ │ │ ├── yaml
│ │ │ │ ├── ref
│ │ │ │ │ ├── classpathRefs3.yaml
│ │ │ │ │ ├── classpathRefs2.yaml
│ │ │ │ │ ├── a.yaml
│ │ │ │ │ ├── subdirectory1
│ │ │ │ │ │ └── refToSubdirectory2.yaml
│ │ │ │ │ ├── subdirectory2
│ │ │ │ │ │ └── refToSubdirectory1.yaml
│ │ │ │ │ ├── refsToA.yaml
│ │ │ │ │ ├── fragmentRefs.yaml
│ │ │ │ │ ├── classpathRefs.yaml
│ │ │ │ │ ├── httpRefs.yaml
│ │ │ │ │ ├── selfRefs.yaml
│ │ │ │ │ ├── nestedSelfRefsReadAsString.yaml
│ │ │ │ │ └── address.yaml
│ │ │ │ ├── type
│ │ │ │ │ ├── integerAsLong.yaml
│ │ │ │ │ ├── numberAsFloat.yaml
│ │ │ │ │ ├── typeNameConflict.yaml
│ │ │ │ │ ├── integerWithLongMaximumAsLong.yaml
│ │ │ │ │ ├── integerWithLongMinimumAsLong.yaml
│ │ │ │ │ ├── unionTypes.yaml
│ │ │ │ │ └── genericJavaType.yaml
│ │ │ │ └── properties
│ │ │ │ │ ├── nullProperties.yaml
│ │ │ │ │ ├── propertyCalledClass.yaml
│ │ │ │ │ ├── objectPropertiesJavaType.yaml
│ │ │ │ │ ├── primitivePropertiesNoJavaType.yaml
│ │ │ │ │ ├── primitiveProperties.yaml
│ │ │ │ │ ├── propertiesThatAreJavaKeywords.yaml
│ │ │ │ │ ├── nonStandardRef.yaml
│ │ │ │ │ ├── propertiesWithWordDelimiters.yaml
│ │ │ │ │ ├── propertiesAreUpperCamelCase.yaml
│ │ │ │ │ └── initializeCollectionProperties.yaml
│ │ │ ├── constructors
│ │ │ │ ├── noPropertiesConstructor.json
│ │ │ │ ├── noRequiredPropertiesConstructor.json
│ │ │ │ ├── requiredArrayPropertyConstructors.json
│ │ │ │ └── requiredPropertyConstructors.json
│ │ │ ├── title
│ │ │ │ ├── titleEnum.json
│ │ │ │ └── title.json
│ │ │ ├── description
│ │ │ │ ├── descriptionEnum.json
│ │ │ │ └── description.json
│ │ │ ├── array
│ │ │ │ └── arrayAsRoot.json
│ │ │ ├── ref
│ │ │ │ ├── classpathRefs3.json
│ │ │ │ ├── classpathRefs2.json
│ │ │ │ ├── absoluteRef.json.template
│ │ │ │ ├── subdirectory1
│ │ │ │ │ └── refToSubdirectory2.json
│ │ │ │ ├── subdirectory2
│ │ │ │ │ └── refToSubdirectory1.json
│ │ │ │ ├── a.json
│ │ │ │ ├── fragmentRefs.json
│ │ │ │ ├── refsToA.json
│ │ │ │ ├── httpRefs.json
│ │ │ │ ├── classpathRefs.json
│ │ │ │ ├── nestedSelfRefsReadAsString.json
│ │ │ │ ├── address.json
│ │ │ │ └── selfRefs.json
│ │ │ ├── type
│ │ │ │ ├── integerAsLong.json
│ │ │ │ ├── numberAsFloat.json
│ │ │ │ ├── typeNameConflict.json
│ │ │ │ ├── integerWithLongMaximumAsLong.json
│ │ │ │ ├── integerWithLongMinimumAsLong.json
│ │ │ │ ├── unionTypes.json
│ │ │ │ └── genericJavaType.json
│ │ │ ├── properties
│ │ │ │ ├── nullProperties.json
│ │ │ │ ├── propertyCalledClass.json
│ │ │ │ ├── objectPropertiesJavaType.json
│ │ │ │ ├── objectPropertiesTitle.json
│ │ │ │ ├── primitivePropertiesNoJavaType.json
│ │ │ │ ├── primitiveProperties.json
│ │ │ │ ├── propertiesThatAreJavaKeywords.json
│ │ │ │ ├── nonStandardRef.json
│ │ │ │ ├── propertiesAreUpperCamelCase.json
│ │ │ │ ├── propertiesWithWordDelimiters.json
│ │ │ │ ├── propertiesAreWithAllWordsUpperCases.json
│ │ │ │ ├── orderedProperties.json
│ │ │ │ └── initializeCollectionProperties.json
│ │ │ ├── sourceSortOrder
│ │ │ │ ├── a.json
│ │ │ │ ├── includes
│ │ │ │ │ ├── aType.json
│ │ │ │ │ └── zType.json
│ │ │ │ └── z.json
│ │ │ ├── toString
│ │ │ ├── jsr303
│ │ │ │ ├── maximum.json
│ │ │ │ ├── minItems.json
│ │ │ │ ├── minimum.json
│ │ │ │ ├── maxLength.json
│ │ │ │ ├── minLength.json
│ │ │ │ ├── pattern.json
│ │ │ │ ├── required.json
│ │ │ │ ├── maxItems.json
│ │ │ │ ├── digits.json
│ │ │ │ ├── minAndMaxItems.json
│ │ │ │ ├── validAdditionalProperties.json
│ │ │ │ ├── all.json
│ │ │ │ ├── validObject.json
│ │ │ │ └── validArray.json
│ │ │ ├── hashCodeAndEquals
│ │ │ │ ├── extendsEmpty.json
│ │ │ │ └── types.json
│ │ │ ├── format
│ │ │ │ ├── nonStandard.json
│ │ │ │ └── customDateTimeFormat.json
│ │ │ ├── polymorphic
│ │ │ │ ├── parentWithPolymorphism.json
│ │ │ │ └── extendsSchema.json
│ │ │ ├── parcelable
│ │ │ │ ├── parcelable-superclass-data.json
│ │ │ │ ├── parcelable-superclass-schema-base.json
│ │ │ │ ├── parcelable-data.json
│ │ │ │ └── parcelable-superclass-schema.json
│ │ │ ├── emptyPackageName
│ │ │ │ ├── levelZeroType.json
│ │ │ │ └── levelOne
│ │ │ │ │ ├── levelOneType.json
│ │ │ │ │ └── levelTwo
│ │ │ │ │ └── levelTwoType.json
│ │ │ ├── dynamic
│ │ │ │ ├── noAdditionalProperties.json
│ │ │ │ ├── childType.json
│ │ │ │ └── parentType.json
│ │ │ ├── javaName
│ │ │ │ ├── duplicateDefaultName.json
│ │ │ │ ├── duplicateName.json
│ │ │ │ ├── javaName.json
│ │ │ │ └── javaNameWithRequiredProperties.json
│ │ │ ├── views
│ │ │ │ └── views.json
│ │ │ ├── fileExtensions
│ │ │ │ ├── nameWithNoExtension
│ │ │ │ └── nameWithExtension.schema.json
│ │ │ ├── includeConstructorPropertiesAnnotation
│ │ │ │ └── testObject.json
│ │ │ ├── required
│ │ │ │ ├── requiredArray.json
│ │ │ │ ├── required.json
│ │ │ │ ├── requiredNestedInObject.json
│ │ │ │ └── requiredNestedInArray.json
│ │ │ ├── excludedFromEqualsAndHashCode
│ │ │ │ └── excludedFromEqualsAndHashCode.json
│ │ │ └── media
│ │ │ │ └── mediaProperties.json
│ │ ├── schema.useInnerClassBuilders
│ │ │ ├── parent.json
│ │ │ └── child.json
│ │ └── ant
│ │ │ ├── example.json
│ │ │ └── exampleWithExtraClasspath.json
│ │ └── java
│ │ ├── com
│ │ └── example
│ │ │ └── MyJsonViewClass.java
│ │ └── org
│ │ └── jsonschema2pojo
│ │ └── integration
│ │ ├── yaml
│ │ └── YamlRefIT.java
│ │ ├── CommentsIT.java
│ │ └── config
│ │ └── ScalaIT.java
└── NOTICE
├── jsonschema2pojo-maven-plugin
├── src
│ ├── test
│ │ └── resources
│ │ │ └── filtered
│ │ │ └── schema
│ │ │ ├── README.md
│ │ │ ├── sub1
│ │ │ ├── README.md
│ │ │ └── example-sub.json
│ │ │ ├── .svn
│ │ │ ├── sub
│ │ │ │ └── sub-svn-file.json
│ │ │ └── svn-file.json
│ │ │ ├── example.json
│ │ │ └── excluded
│ │ │ └── example-excluded.json
│ └── main
│ │ ├── resources
│ │ └── META-INF
│ │ │ └── m2e
│ │ │ └── lifecycle-mapping-metadata.xml
│ │ └── java
│ │ └── org
│ │ └── jsonschema2pojo
│ │ └── maven
│ │ └── package-info.java
└── NOTICE
├── jsonschema2pojo-scalagen
├── src
│ ├── main
│ │ └── scala
│ │ │ ├── PlaceHolder.java
│ │ │ └── com
│ │ │ └── mysema
│ │ │ ├── scalagen
│ │ │ ├── ast
│ │ │ │ └── BeginClosureExpr.scala
│ │ │ ├── ConversionSettings.scala
│ │ │ ├── ScalaVersion.scala
│ │ │ ├── Cli.scala
│ │ │ ├── Rename.scala
│ │ │ ├── RemoveAsserts.scala
│ │ │ └── Synchronized.scala
│ │ │ └── scala
│ │ │ └── BeanUtils.scala
│ └── test
│ │ └── scala
│ │ └── com
│ │ └── mysema
│ │ ├── examples
│ │ ├── Gender.java
│ │ ├── Underscore.java
│ │ ├── Protected.java
│ │ ├── Literals.java
│ │ ├── WithStatic.java
│ │ ├── Asserts2.java
│ │ ├── AbstractProperties.java
│ │ ├── ValueOf.java
│ │ ├── AbstractClass.java
│ │ ├── WithComments.java
│ │ ├── A.java
│ │ ├── Constructors2.java
│ │ ├── ConstructorParams.java
│ │ ├── TryMe.java
│ │ ├── Base.java
│ │ ├── Static.java
│ │ ├── StrikeLabel.java
│ │ ├── Increment.java
│ │ ├── Wildcard.java
│ │ ├── LazyInitBeanAccessor.java
│ │ ├── Initializers.java
│ │ ├── Modifiers.java
│ │ ├── Methods.java
│ │ ├── Operators.java
│ │ ├── Assignment.java
│ │ ├── Diamond.java
│ │ ├── Constructors3.java
│ │ ├── Literal.java
│ │ ├── Person.java
│ │ ├── WithStaticAndInstance.java
│ │ ├── EqualsHashCode.java
│ │ ├── Constructors.java
│ │ ├── SwitchCase2.java
│ │ ├── ParameterDef.java
│ │ ├── IDao.java
│ │ ├── Casts.java
│ │ ├── SuperConstructors.java
│ │ ├── Immutable2.java
│ │ ├── Fields.java
│ │ ├── Reserved.java
│ │ ├── Asserts.java
│ │ ├── PrimitiveInits.java
│ │ ├── Concatenation.java
│ │ ├── Bean3.java
│ │ ├── Bag2.java
│ │ ├── Returns.java
│ │ ├── Switch.java
│ │ ├── IfElse.java
│ │ ├── Immutable.java
│ │ ├── Bean4.java
│ │ ├── SelectedText.java
│ │ ├── ArrayTests.java
│ │ ├── Concept.java
│ │ ├── InnerClasses.java
│ │ ├── Loop.java
│ │ ├── BagWindow.java
│ │ ├── BeanWithUnderscores.java
│ │ ├── SwitchCase.java
│ │ ├── ArrayUtils.java
│ │ ├── Bean2.java
│ │ ├── QueryDelegate.java
│ │ ├── Bean.java
│ │ ├── Resource.java
│ │ ├── LocationAndKind.java
│ │ └── LongLinesIncludingAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName.java
│ │ └── scalagen
│ │ ├── Enums.scala
│ │ ├── ScalaVersionTest.scala
│ │ ├── HelpersTest.scala
│ │ └── ReturnsTest.scala
├── README.md
└── scalagen
├── .travis.yml
├── .gitignore
├── NOTICE
├── jsonschema2pojo-ant
├── NOTICE
├── src
│ └── main
│ │ └── java
│ │ └── org
│ │ └── jsonschema2pojo
│ │ └── ant
│ │ └── package-info.java
└── pom.xml
├── jsonschema2pojo-cli
├── NOTICE
└── src
│ └── main
│ ├── scripts
│ ├── jsonschema2pojo.bat
│ └── jsonschema2pojo.sh
│ └── java
│ └── org
│ └── jsonschema2pojo
│ └── cli
│ └── package-info.java
└── CONTRIBUTING.md
/jsonschema2pojo-core/src/test/resources/schema/required.json:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/lib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/comments.yaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/simpleTypeAsRoot.json:
--------------------------------------------------------------------------------
1 | true
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':lib'
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/arrayAsRoot.json:
--------------------------------------------------------------------------------
1 | [
2 | 1, 2, 3
3 | ]
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/arrayAsRoot.yaml:
--------------------------------------------------------------------------------
1 | - 1
2 | - 2
3 | - 3
4 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/simpleTypeAsRoot.yaml:
--------------------------------------------------------------------------------
1 | true
2 | ...
3 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/a.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object"
3 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/comments.json:
--------------------------------------------------------------------------------
1 | {
2 | "a" : 1 /* comment here */
3 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/regression/foo.baz.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object"
3 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/java/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'gradle-jsonschema2pojo-example'
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/test/resources/filtered/schema/README.md:
--------------------------------------------------------------------------------
1 | This is a readme that should be ignored.
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/README.md:
--------------------------------------------------------------------------------
1 | a readme that should not be included.
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/regression/spaces in path.json:
--------------------------------------------------------------------------------
1 | {
2 | "type":"object"
3 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/PlaceHolder.java:
--------------------------------------------------------------------------------
1 | //hack to generate package javadoc
2 | public class PlaceHolder {}
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/simplePropertiesInArrayItem.yaml:
--------------------------------------------------------------------------------
1 | - scalar: what
2 | - scalar: 99
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | script: "mvn verify"
3 | jdk:
4 | - openjdk8
5 | cache:
6 | directories:
7 | - "$HOME/.m2"
8 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/schema/enum.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "string",
3 | "enum" : ["one", "two", "three"]
4 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/test/resources/filtered/schema/sub1/README.md:
--------------------------------------------------------------------------------
1 | This is another readme that should be ignored.
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/comments/comments.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object" /* comment here */
3 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfo.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {}
4 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/README.md:
--------------------------------------------------------------------------------
1 | Forked from https://github.com/timowest/scalagen/tree/master/scalagen
2 |
3 | © Timo Westkämper
4 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/scalagen:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | scala -cp target/dependencies/*:target/classes/ com.mysema.scalagen.Cli $1 $2
3 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/additionalProperties/defaultAdditionalProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object"
3 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumWithEmptyString.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "string",
3 | "enum" : [""]
4 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/array.yaml:
--------------------------------------------------------------------------------
1 | a:
2 | - '0': 0
3 | - '1': 1
4 | - '2': 2
5 | b:
6 | - 1
7 | - 2
8 | - 3
9 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumWithNullValue.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "string",
3 | "enum" : ["a", null]
4 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/simpleTypes.yaml:
--------------------------------------------------------------------------------
1 | a: abc
2 | b: 123
3 | c: 12999999999999999999999.99
4 | d: true
5 | e: null
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/classpathRefs3.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | transitive:
3 | type: string
4 | type: object
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/type/integerAsLong.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | longProperty:
3 | type: integer
4 | type: object
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/type/numberAsFloat.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | floatProperty:
3 | type: number
4 | type: object
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/src/main/resources/META-INF/gradle-plugins/jsonschema2pojo.properties:
--------------------------------------------------------------------------------
1 | implementation-class=org.jsonschema2pojo.gradle.JsonSchemaPlugin
2 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/nullProperties.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | property:
3 | type: string
4 | type: object
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/propertyCalledClass.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | class:
3 | type: string
4 | type: object
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/constructors/noPropertiesConstructor.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | }
5 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/type/typeNameConflict.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | typeNameConflict:
3 | type: object
4 | type: object
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Gender.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public enum Gender {
4 | MALE,
5 | FEMALE
6 | }
7 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumWithExtendedCharacters.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "string",
3 | "enum" : ["Herr", "Frau", "Fräulein"]
4 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumWithNoValidCharactersForIdentifier.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "string",
3 | "enum" : [":", "≥", "<"]
4 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/additionalProperties/noAdditionalProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "additionalProperties" : false
4 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/extendsString.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "extends" : {
4 | "type" : "string"
5 | }
6 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/classpathRefs2.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | propertyRelativeRef:
3 | $ref: classpathRefs3.json
4 | type: object
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/simplePropertiesInArrayItem.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scalar" : "what"
4 | },
5 | {
6 | "scalar" : 99
7 | }
8 | ]
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumWithTitle.json:
--------------------------------------------------------------------------------
1 | {
2 | "title": "Foo Enum",
3 | "type" : "string",
4 | "enum" : ["1", "2", "3"]
5 | }
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/title/titleEnum.json:
--------------------------------------------------------------------------------
1 | {
2 | "title" : "A title for this enum",
3 | "type":"string",
4 | "enum": ["one", "two"]
5 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Underscore.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Underscore {
4 |
5 | String prop_;
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfBWithNoProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "b.json"
5 | }
6 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/simpleTypes.json:
--------------------------------------------------------------------------------
1 | {
2 | "a" : "abc",
3 | "b" : 123,
4 | "c" : 12999999999999999999999.99,
5 | "d" : true,
6 | "e" : null
7 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumAsRoot.json:
--------------------------------------------------------------------------------
1 | {
2 | "javaType" : "com.example.enums.EnumAsRoot",
3 | "type" : "string",
4 | "enum" : ["a", "b", "c"]
5 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfoWithSchemaProperty.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "deserializationClassProperty": "@clazz",
4 | "properties" : {}
5 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/type/integerWithLongMaximumAsLong.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | longProperty:
3 | maximum: 2147483648
4 | type: integer
5 | type: object
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/type/integerWithLongMinimumAsLong.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | longProperty:
3 | minimum: -2147483649
4 | type: integer
5 | type: object
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Protected.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Protected {
4 |
5 | protected Protected() {
6 |
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/schema/embeddedRef.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "definitions" : {
4 | "embedded" : {
5 | "type" : "object"
6 | }
7 | }
8 |
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/description/descriptionEnum.json:
--------------------------------------------------------------------------------
1 | {
2 | "description" : "A description for this enum",
3 | "type":"string",
4 | "enum": ["one", "two"]
5 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/java/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Petersoj/jsonschema2pojo/master/jsonschema2pojo-gradle-plugin/example/java/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/regression/underscores.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "An Address following the convention of http://microformats.org/wiki/hcard",
3 | "_name": "object"
4 | }
5 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Literals.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Literals {
4 | int a = 123_456;
5 | int b = 0b101010;
6 | long c = 123_456L;
7 | }
8 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Petersoj/jsonschema2pojo/master/jsonschema2pojo-gradle-plugin/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/additionalProperties/additionalPropertiesObject.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "additionalProperties" : {
4 | "type" : "object"
5 | }
6 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/additionalProperties/additionalPropertiesString.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "additionalProperties" : {
4 | "type" : "string"
5 | }
6 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/b.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "parentProperty": {
5 | "type": "string"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/objectPropertiesJavaType.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | a:
3 | javaType: org.jsonschema2pojo.NoopAnnotator
4 | type: object
5 | type: object
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/complexObject.yaml:
--------------------------------------------------------------------------------
1 | '1':
2 | '2': {}
3 | '3':
4 | - 1
5 | - 2
6 | - 3
7 | a:
8 | aa:
9 | aaa: aaaa
10 | b:
11 | aa:
12 | ccc: dddd
13 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/additionalProperties/additionalPropertiesPrimitiveBoolean.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "additionalProperties" : {
4 | "type" : "boolean"
5 | }
6 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/array/arrayAsRoot.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "array",
3 | "items" : {
4 | "javaType" : "com.example.RootArrayItem",
5 | "type" : "object"
6 | }
7 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/classpathRefs3.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "transitive" : {
5 | "type" : "string"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/type/integerAsLong.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "longProperty" : {
5 | "type" : "integer"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/type/numberAsFloat.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "floatProperty" : {
5 | "type" : "number"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/nullProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "property" : {
5 | "type" : "string"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/propertyCalledClass.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "class" : {
5 | "type" : "string"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/sourceSortOrder/a.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "refToA" : {
5 | "$ref": "includes/aType.json"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/type/typeNameConflict.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties": {
4 | "typeNameConflict" : {
5 | "type" : "object"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/primitivePropertiesNoJavaType.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | a:
3 | type: integer
4 | b:
5 | type: number
6 | c:
7 | type: boolean
8 | type: object
9 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Petersoj/jsonschema2pojo/master/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Petersoj/jsonschema2pojo/master/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/sourceSortOrder/includes/aType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyOfA" : {
5 | "type" : "string"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/sourceSortOrder/includes/zType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyOfZ" : {
5 | "type" : "string"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Petersoj/jsonschema2pojo/master/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Petersoj/jsonschema2pojo/master/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumWithUppercaseProperty.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "TimeFormat" : {
5 | "enum" : ["12h", "24h"]
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/a.yaml:
--------------------------------------------------------------------------------
1 | additionalProperties:
2 | javaType: com.example.AdditionalPropertyValue
3 | type: object
4 | properties:
5 | propertyOfA:
6 | type: string
7 | type: object
8 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/complexPropertiesInArrayItem.yaml:
--------------------------------------------------------------------------------
1 | - list:
2 | - a: 1
3 | c: hey
4 | obj:
5 | name: k
6 | - list:
7 | - b: 177
8 | c: hey again
9 | obj:
10 | index: 8
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/classpathRefs2.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyRelativeRef" : {
5 | "$ref" : "classpathRefs3.json"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/toString/polygon.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "sides": {
5 | "type": "integer"
6 | }
7 | },
8 | "additionalProperties": false
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/WithStatic.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public final class WithStatic {
4 |
5 | public static final String CONSTANT = "";
6 |
7 | private WithStatic() {}
8 | }
9 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/maximum.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "maximum" : {
5 | "type" : "number",
6 | "maximum" : 9.9
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/minItems.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "minItems" : {
5 | "type" : "array",
6 | "minItems" : 5
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/minimum.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "minimum" : {
5 | "type" : "number",
6 | "minimum" : 1.1
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/subdirectory1/refToSubdirectory2.yaml:
--------------------------------------------------------------------------------
1 | javaType: com.example.RefToSubdirectory1
2 | properties:
3 | refToOther:
4 | $ref: ../subdirectory2/refToSubdirectory1.json
5 | type: object
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/subdirectory2/refToSubdirectory1.yaml:
--------------------------------------------------------------------------------
1 | javaType: com.example.RefToSubdirectory2
2 | properties:
3 | refToOther:
4 | $ref: ../subdirectory1/refToSubdirectory2.json
5 | type: object
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Asserts2.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Asserts2 {
4 |
5 | public Asserts2(boolean a, boolean b) {
6 | assert a && b;
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/integerEnumAsRoot.json:
--------------------------------------------------------------------------------
1 | {
2 | "javaType" : "com.example.enums.IntegerEnumAsRoot",
3 | "type" : "integer",
4 | "enum" : [1, 2, 3],
5 | "javaEnumNames" : ["One", "Two", "Three"]
6 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/maxLength.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "maxLength" : {
5 | "type" : "string",
6 | "maxLength" : 10
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/minLength.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "minLength" : {
5 | "type" : "string",
6 | "minLength" : 10
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/pattern.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "pattern" : {
5 | "type" : "string",
6 | "pattern" : "abc.*"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/required.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "required" : {
5 | "type" : "string",
6 | "required" : true
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/type/integerWithLongMaximumAsLong.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "longProperty" : {
5 | "type" : "integer",
6 | "maximum": 2147483648
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/type/integerWithLongMinimumAsLong.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "longProperty" : {
5 | "type" : "integer",
6 | "minimum": -2147483649
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/AbstractProperties.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public abstract class AbstractProperties {
4 |
5 | private int capacity;
6 |
7 | protected abstract int capacity();
8 | }
9 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/hashCodeAndEquals/extendsEmpty.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "extends" : {
4 | "type" : "object",
5 | "additionalProperties" : false
6 | },
7 | "additionalProperties" : true
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/maxItems.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "maxItems" : {
5 | "type" : "array",
6 | "maxItems" : 5
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/README.md:
--------------------------------------------------------------------------------
1 | The Android SDK is required to build this project. After installing the Android
2 | Studio, add a `local.properties` file with the path to the SDK. For example,
3 | `sdk.dir=/Users//Library/Android/sdk/`
4 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/doubleEnumAsRoot.json:
--------------------------------------------------------------------------------
1 | {
2 | "javaType" : "com.example.enums.DoubleEnumAsRoot",
3 | "type" : "number",
4 | "enum" : [1.0, 2.5, 3],
5 | "javaEnumNames" : ["One", "TwoAndAHalf", "Three"]
6 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/digits.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "decimal": {
5 | "type": "number",
6 | "integerDigits": 5,
7 | "fractionalDigits": 10
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scalagen/ast/BeginClosureExpr.scala:
--------------------------------------------------------------------------------
1 | package com.mysema.scalagen.ast
2 |
3 | import japa.parser.ast.expr.NameExpr
4 |
5 | class BeginClosureExpr(params: String) extends NameExpr(params) {
6 | def params = getName
7 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/regression/extendedCharacters.json:
--------------------------------------------------------------------------------
1 | {
2 | "type":"object",
3 | "properties" : {
4 | "name" : {
5 | "type" : "string",
6 | "description" : "ЫЩДђиЊЉЯ"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/refsToA.yaml:
--------------------------------------------------------------------------------
1 | additionalProperties:
2 | $ref: a.json
3 | properties:
4 | a:
5 | $ref: a.json
6 | arrayOfA:
7 | items:
8 | $ref: a.json
9 | type: array
10 | type: object
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scalagen/ConversionSettings.scala:
--------------------------------------------------------------------------------
1 | package com.mysema.scalagen
2 |
3 | case class ConversionSettings(splitLongLines: Boolean = true)
4 |
5 | object ConversionSettings {
6 | def defaultSettings = ConversionSettings()
7 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/objectPropertiesJavaType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "a" : {
5 | "existingJavaType": "org.jsonschema2pojo.NoopAnnotator",
6 | "type": "object"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/primitiveProperties.yaml:
--------------------------------------------------------------------------------
1 | javaType: com.example.PrimitiveProperties
2 | properties:
3 | a:
4 | type: integer
5 | b:
6 | type: number
7 | c:
8 | type: boolean
9 | type: object
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/ValueOf.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class ValueOf {
4 |
5 | public void foo() {
6 | double a = Double.valueOf("1.0");
7 | System.out.println(a - 3.0);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/absoluteRef.json.template:
--------------------------------------------------------------------------------
1 | {
2 | "javaType" : "com.example.AbsoluteRef",
3 | "type" : "object",
4 | "properties" : {
5 | "address" : {
6 | "$ref" : "$ABSOLUTE_REF"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidExample
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfA.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "a.json"
5 | },
6 | "properties": {
7 | "parent": {
8 | "type": "string"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/objectPropertiesTitle.json:
--------------------------------------------------------------------------------
1 | {
2 | "title": "Foo Object",
3 | "type" : "object",
4 | "properties" : {
5 | "a" : {
6 | "title": "bar object",
7 | "type": "object"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/propertiesThatAreJavaKeywords.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | abstract:
3 | type: string
4 | enum:
5 | type: string
6 | public:
7 | type: string
8 | void:
9 | type: string
10 | type: object
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/array.json:
--------------------------------------------------------------------------------
1 | {
2 | "a" : [
3 | {
4 | "0" : 0
5 | },
6 | {
7 | "1" : 1
8 | },
9 | {
10 | "2" : 2
11 | }
12 | ],
13 | "b" : [1, 2, 3]
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema.useInnerClassBuilders/parent.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "parentProperty" : { "type" : "string" },
5 | "sharedProperty" : { "type" : "string" }
6 | },
7 | "required" : ["parentProperty"]
8 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/format/nonStandard.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "stringAsNonStandard" : {
5 | "type" : "string",
6 | "format" : "non-standard"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/test/resources/filtered/schema/sub1/example-sub.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "type": "object",
4 | "properties": {
5 | "prop": {
6 | "type": "string"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/AbstractClass.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public abstract class AbstractClass {
4 |
5 | public static final String constant = "XXX";
6 |
7 | public final String property = "XXX";
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/WithComments.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class WithComments {
4 |
5 | /**
6 | * javadocs
7 | */
8 | public void method() {
9 | // comments inside
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/scalagen/Enums.scala:
--------------------------------------------------------------------------------
1 | package com.mysema.scalagen
2 |
3 | object Gender extends Enumeration {
4 | val MALE = new Gender(0)
5 | val FEMALE = new Gender(1)
6 | }
7 |
8 | class Gender(val id: Int) extends Gender.Value {
9 |
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/additionalProperties/additionalPropertiesArraysOfStrings.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "additionalProperties" : {
4 | "type" : "array",
5 | "items" : {
6 | "type" : "string"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/c.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "duplicatedProp": {
5 | "type": "string"
6 | },
7 | "cProp": {
8 | "type": "integer"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfB.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "b.json"
5 | },
6 | "properties": {
7 | "childProperty": {
8 | "type": "string"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/test/resources/filtered/schema/.svn/sub/sub-svn-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "type": "object",
4 | "properties": {
5 | "prop": {
6 | "type": "string"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/typeWithEnumProperty.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "enum_Property" : {
5 | "type" : "string",
6 | "enum" : ["one", "secondOne", "3rd one", "4 ! 1"]
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/fragmentRefs.yaml:
--------------------------------------------------------------------------------
1 | additionalProperties: false
2 | properties:
3 | a:
4 | $ref: a.json
5 | fragmentOfA:
6 | $ref: a.json/#/additionalProperties
7 | fragmentOfSelf:
8 | $ref: '#/properties/a'
9 | type: object
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/test/resources/filtered/schema/example.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "type": "object",
4 | "properties": {
5 | "subProp": {
6 | "$ref": "sub1/example-sub.json"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/test/resources/filtered/schema/excluded/example-excluded.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "type": "object",
4 | "properties": {
5 | "prop": {
6 | "type": "string"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/A.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class A extends B {
4 | public A() {
5 | super("args");
6 | }
7 | }
8 |
9 | class B {
10 |
11 | public B(String s) {
12 |
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/test/resources/filtered/schema/.svn/svn-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "type": "object",
4 | "properties": {
5 | "subProp": {
6 | "$ref": "sub/sub-svn-file.json"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Constructors2.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Constructors2 {
4 |
5 | class C {
6 | private final int a;
7 | public C(int a) {
8 | this.a = a;
9 | }
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/toString/square.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "quadrilateral.json"
5 | },
6 | "properties": {
7 | "length": {
8 | "type": "number"
9 | }
10 | },
11 | "additionalProperties": false
12 | }
13 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema.useInnerClassBuilders/child.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "extends" : {
4 | "$ref" : "parent.json"
5 | },
6 | "properties" : {
7 | "childProperty" : { "type" : "integer"},
8 | "sharedProperty" : { "type" : "string" }
9 | }
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfSubtypeOfB.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "subtypeOfB.json"
5 | },
6 | "properties": {
7 | "childChildProperty": {
8 | "type": "string"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/minAndMaxItems.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "minAndMaxItems" : {
5 | "type" : "array",
6 | "minItems" : 2,
7 | "maxItems" : 4
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/polymorphic/parentWithPolymorphism.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "deserializationClassProperty" : "deserializationClassName",
4 | "properties" : {
5 | "propertyOfParent" : {
6 | "type" : "string"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/ConstructorParams.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class ConstructorParams {
4 |
5 | private int bar;
6 |
7 | public ConstructorParams(int bar) {
8 | this.bar = bar * 2; // ok in Java
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/TryMe.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | class TryMe {
4 |
5 | void someMethod(int num) {}
6 |
7 | void useIt() {
8 | int n = 5;
9 | someMethod(Integer.toString(n + 1).length() * 5);
10 | }
11 |
12 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/wiremock/mappings/address500.json:
--------------------------------------------------------------------------------
1 | {
2 | "request": {
3 | "method": "GET",
4 | "url": "/address500.json"
5 | },
6 | "response": {
7 | "status": 500,
8 | "body": "Server error",
9 | "headers": {
10 | "Content-Type": "plain/test"
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/java/src/main/resources/json/external_dependencies.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "An example on how to reference pre-existing classes",
3 | "type": "object",
4 | "properties": {
5 | "a_joda_time_object": { "type": "object", "javaType": "org.joda.time.DateTime" }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/parcelable/parcelable-superclass-data.json:
--------------------------------------------------------------------------------
1 | {
2 | "baseBooleanProperty": true,
3 | "baseStringProperty": "basestring",
4 | "baseIntegerProperty": 1234,
5 | "booleanProperty" : true,
6 | "stringProperty" : "aaa",
7 | "integerProperty" : 10
8 | }
9 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/type/unionTypes.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | booleanProperty:
3 | type:
4 | - boolean
5 | - string
6 | integerProperty:
7 | type:
8 | - integer
9 | - 'null'
10 | stringProperty:
11 | type:
12 | - string
13 | type: object
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Base.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | class Base {
4 |
5 | Base() {
6 | }
7 |
8 | Base(String s) {
9 | }
10 | }
11 |
12 | class Derived extends Base {
13 | Derived(String s) {
14 | super(s);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/wiremock/mappings/address404.json:
--------------------------------------------------------------------------------
1 | {
2 | "request": {
3 | "method": "GET",
4 | "url": "/address404.json"
5 | },
6 | "response": {
7 | "status": 404,
8 | "body": "File not found",
9 | "headers": {
10 | "Content-Type": "plain/test"
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/java/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed May 01 02:20:18 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://services.gradle.org/distributions/gradle-2.3-bin.zip
7 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/emptyPackageName/levelZeroType.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "A schema in the root package.",
4 | "type": "object",
5 | "properties": {
6 | "name": {
7 | "type": "string"
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfSubtypeOfBDifferentType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "subtypeOfB.json"
5 | },
6 | "properties": {
7 | "childChildProperty": {
8 | "type": "integer"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/polymorphic/extendsSchema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyOfChild" : {
5 | "type" : "string"
6 | }
7 | },
8 | "extends" : {
9 | "$ref" : "parentWithPolymorphism.json"
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/subdirectory1/refToSubdirectory2.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.RefToSubdirectory1",
4 | "properties" : {
5 | "refToOther" : {
6 | "$ref" : "../subdirectory2/refToSubdirectory1.json"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/subdirectory2/refToSubdirectory1.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.RefToSubdirectory2",
4 | "properties" : {
5 | "refToOther" : {
6 | "$ref" : "../subdirectory1/refToSubdirectory2.json"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/sourceSortOrder/z.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "refToA" : {
5 | "$ref": "includes/aType.json"
6 | },
7 | "refToZ" : {
8 | "$ref" : "includes/zType.json"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
7 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/.svn/svn.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "a location on s3",
4 | "type": "object",
5 | "properties": {
6 | "prop": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/included.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "a location on s3",
4 | "type": "object",
5 | "properties": {
6 | "prop": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/sub/sub.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "a generic sub document",
4 | "type": "object",
5 | "properties": {
6 | "prop": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/toString/intPair.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "javaType": "com.example.IntPair",
4 | "properties": {
5 | "l": {
6 | "type": "integer"
7 | },
8 | "r": {
9 | "type": "integer"
10 | }
11 | },
12 | "additionalProperties": false
13 | }
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/dynamic/noAdditionalProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "javaType": "com.example.NoAdditionalProperties",
4 | "properties": {
5 | "stringValue": {
6 | "type": "string"
7 | }
8 | },
9 | "additionalProperties": false
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/sub/.svn/sub.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "a generic sub document",
4 | "type": "object",
5 | "properties": {
6 | "prop": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/sub/sub2/sub.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "a generic sub document",
4 | "type": "object",
5 | "properties": {
6 | "prop": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/nonStandardRef.yaml:
--------------------------------------------------------------------------------
1 | additionalProperties: false
2 | definitions:
3 | com.example.Foo:
4 | properties:
5 | bar:
6 | type: string
7 | type: object
8 | properties:
9 | foo:
10 | $ref: '#/definitions/com.example.Foo'
11 | type: object
12 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/propertiesWithWordDelimiters.yaml:
--------------------------------------------------------------------------------
1 | javaType: com.example.WordDelimit
2 | properties:
3 | property-with-hyphens:
4 | type: string
5 | property_with mixed-delimiters:
6 | type: string
7 | property_with_underscores:
8 | type: string
9 | type: object
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Static.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Static {
4 |
5 | public static void main(String[] args) {
6 | // do nothing
7 | }
8 |
9 | public static void main2(String args[]) {
10 | // do nothing
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/emptyPackageName/levelOne/levelOneType.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "A schema at the first level of packaging.",
4 | "type": "object",
5 | "properties": {
6 | "name": {
7 | "type": "string"
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/excluded.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "a schema that should be exluded.",
4 | "type": "object",
5 | "properties": {
6 | "prop": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/filtering/sub/sub2/.svn/sub.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "a generic sub document",
4 | "type": "object",
5 | "properties": {
6 | "prop": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/propertiesAreUpperCamelCase.yaml:
--------------------------------------------------------------------------------
1 | javaType: com.example.UpperCase
2 | properties:
3 | ' PropertyThreeWithSpace':
4 | type: string
5 | Property1:
6 | type: string
7 | PropertyTwo:
8 | type: integer
9 | propertyFour:
10 | type: string
11 | type: object
12 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/StrikeLabel.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import javax.swing.JLabel;
4 |
5 |
6 | public class StrikeLabel extends JLabel {
7 | public StrikeLabel(String text) {
8 | super(text);
9 | }
10 |
11 | public StrikeLabel() {
12 | this("");
13 | }
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/enumWithCustomJavaNames.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "enum_Property" : {
5 | "type" : "string",
6 | "enum" : ["1", "2", "3", "4"],
7 | "javaEnumNames" : ["ONE","TWO","THREE", "FOUR"]
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/emptyPackageName/levelOne/levelTwo/levelTwoType.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "description": "A schema at the second level of packaging.",
4 | "type": "object",
5 | "properties": {
6 | "name": {
7 | "type": "string"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/integerEnumToSerialize.json:
--------------------------------------------------------------------------------
1 | {
2 | "javaType" : "com.example.enums.IntegerEnumToSerialize",
3 | "properties" : {
4 | "testEnum" : {
5 | "type" : "integer",
6 | "enum" : [1, 2, 3],
7 | "javaEnumNames" : ["One", "Two", "Three"]
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/javaName/duplicateDefaultName.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "type": "object",
4 | "properties": {
5 | "one": {
6 | "type": "string"
7 | },
8 | "two": {
9 | "type": "string",
10 | "javaName": "one"
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/a.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyOfA" : {
5 | "type" : "string"
6 | }
7 | },
8 | "additionalProperties" : {
9 | "javaType" : "com.example.AdditionalPropertyValue",
10 | "type" : "object"
11 | }
12 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/views/views.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "notInView": {
5 | "type": "string"
6 | },
7 | "inView": {
8 | "type": "string",
9 | "javaJsonView": "com.example.MyJsonViewClass"
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Increment.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Increment {
4 |
5 | public void doSomething() {
6 | int i = 0;
7 | int[] ints = new int[10];
8 | while (i < 10) {
9 | System.out.println(ints[i++]);
10 | }
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/complexObject.json:
--------------------------------------------------------------------------------
1 | {
2 | "a" : {
3 | "aa" : {
4 | "aaa" : "aaaa"
5 | }
6 | },
7 | "b" : {
8 | "aa" : {
9 | "ccc" : "dddd"
10 | }
11 | },
12 | "1" : {
13 | "2" : {},
14 | "3" : [1, 2, 3]
15 |
16 | }
17 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Wildcard.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import java.util.List;
4 |
5 | public class Wildcard {
6 |
7 | int foo(List> list) {
8 | return list.size();
9 | }
10 |
11 | int bar(List extends CharSequence> list) {
12 | return list.size();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfC.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "c.json"
5 | },
6 | "properties": {
7 | "duplicatedProp": {
8 | "type": "string"
9 | },
10 | "cSubtypeProp": {
11 | "type": "boolean"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/LazyInitBeanAccessor.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class LazyInitBeanAccessor {
4 |
5 | private String value;
6 |
7 | public String getValue() {
8 | if (value == null) {
9 | value = "XXX";
10 | }
11 | return value;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfSubtypeOfA.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "subtypeOfA.json"
5 | },
6 | "properties": {
7 | "parent" : {
8 | "type": "string"
9 | },
10 | "child": {
11 | "type": "string"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/fileExtensions/nameWithNoExtension:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "d" : {
5 | "type" : "integer"
6 | },
7 | "e" : {
8 | "type" : "number"
9 | },
10 | "f" : {
11 | "type" : "boolean"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Initializers.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Initializers {
4 |
5 | static final String staticValue;
6 |
7 | static {
8 | staticValue = "xx";
9 | }
10 |
11 | final String value;
12 |
13 | {
14 | value = "x";
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Modifiers.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Modifiers {
4 |
5 | private transient String foo = "foo";
6 |
7 | private volatile String bar = "bar";
8 |
9 | public synchronized void foobar() {
10 | System.out.println("Hello World");
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/toString/arrayOfArrays.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "grid": {
5 | "type": "array",
6 | "items": {
7 | "type": "array",
8 | "items": {
9 | "type": "number"
10 | }
11 | }
12 | }
13 | },
14 | "additionalProperties": false
15 | }
16 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Methods.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Methods {
4 |
5 | public void pl(String s) {
6 | System.out.println(s);
7 | }
8 |
9 | public void doSmth(int i) {
10 | switch (i) {
11 | case 3:
12 | return;
13 | }
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/fileExtensions/nameWithExtension.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "a" : {
5 | "type" : "integer"
6 | },
7 | "b" : {
8 | "type" : "number"
9 | },
10 | "c" : {
11 | "type" : "boolean"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/validAdditionalProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "additionalProperties" : {
4 | "properties" : {
5 | "maximum" : {
6 | "type" : "number",
7 | "maximum" : 9.9
8 | }
9 | },
10 | "additionalProperties" : false
11 | }
12 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/primitivePropertiesNoJavaType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "a" : {
5 | "type" : "integer"
6 | },
7 | "b" : {
8 | "type" : "number"
9 | },
10 | "c" : {
11 | "type" : "boolean"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Git derived files #
2 | *.orig
3 |
4 | # Eclipse files #
5 | .classpath
6 | .settings
7 | .project
8 | .metadata
9 |
10 | # Maven derived files #
11 | target/
12 | apidocs
13 |
14 | # Gradle derived files #
15 | build/
16 | .gradle
17 |
18 | # IntelliJ files #
19 | .idea
20 | *.iml
21 |
22 | # Scratch files
23 | .#*
24 | .*.swp
25 |
26 | # Mac files #
27 | .DS_Store
28 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/dynamic/childType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "parentType.json"
5 | },
6 | "properties": {
7 | "childStringValue": {
8 | "type": "string"
9 | },
10 | "childNumberValue": {
11 | "type": "number"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/javaName/duplicateName.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-04/schema#",
3 | "type": "object",
4 | "properties": {
5 | "one": {
6 | "type": "string",
7 | "javaName": "three"
8 | },
9 | "two": {
10 | "type": "string",
11 | "javaName": "three"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Operators.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Operators {
4 |
5 | // def foo(j:Int):Int = {
6 | // var i:Int = j
7 | // return {val k = i; i = i + 1; k }
8 | //}
9 |
10 | // FIXME
11 | // int foo(int j){
12 | // int i = j;
13 | // return i++;
14 | // }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/scalagen/ScalaVersionTest.scala:
--------------------------------------------------------------------------------
1 | package com.mysema.scalagen
2 |
3 | import org.junit.Test
4 | import org.junit.Assert._
5 | import java.util.Collections
6 |
7 | class ScalaVersionTest {
8 |
9 | @Test
10 | def VersionOrdering {
11 | assertTrue(Scala211 > Scala210)
12 | assertTrue(Scala210 > Scala29)
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/subtypeOfSubtypeOfC.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "subtypeOfC.json"
5 | },
6 | "properties": {
7 | "duplicatedProp": {
8 | "type": "string"
9 | },
10 | "cSubtypeSubtypeProp": {
11 | "type": "integer"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/includeConstructorPropertiesAnnotation/testObject.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "x": {
5 | "type": "string"
6 | },
7 | "y": {
8 | "type": "string"
9 | },
10 | "z": {
11 | "type": "string"
12 | }
13 | },
14 | "required": [
15 | "x",
16 | "y"
17 | ]
18 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/regression/extends/SimpleMessage.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "AuthMessage.schema.json"
5 | },
6 | "javaType": "org.abc.SimpleMessage",
7 | "additionalProperties": false,
8 | "properties": {
9 | "msg": {
10 | "type": "string"
11 | }
12 | },
13 | "required": ["msg"]
14 | }
15 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/type/unionTypes.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "booleanProperty" : {
5 | "type" : ["boolean", "string"]
6 | },
7 | "stringProperty" : {
8 | "type" : ["string"]
9 | },
10 | "integerProperty" : {
11 | "type" : ["integer", "null"]
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/primitiveProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.PrimitiveProperties",
4 | "properties" : {
5 | "a" : {
6 | "type" : "integer"
7 | },
8 | "b" : {
9 | "type" : "number"
10 | },
11 | "c" : {
12 | "type" : "boolean"
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/toString/quadrilateral.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "$ref": "polygon.json"
5 | },
6 | "properties": {
7 | "diagonals": {
8 | "type": "array",
9 | "items": {
10 | "type": "number",
11 | "minItems": 2,
12 | "maxItems": 2
13 | }
14 | }
15 | },
16 | "additionalProperties": false
17 | }
18 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Assignment.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 |
4 | public class Assignment {
5 |
6 | // def foo(j:Int):Unit = {
7 | // var i:Int = j
8 | // System.out.println({i = i + 1; i} > j)
9 | // }
10 |
11 | // FIXME
12 | // void foo(int j){
13 | // int i = j;
14 | // System.out.println((i = i + 1) > j);
15 | // }
16 | }
17 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/classpathRefs.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | propertyClasspathRef:
3 | $ref: classpath:/schema/ref/a.json
4 | propertyJavaRef:
5 | $ref: java:/schema/description/description.json
6 | propertyResourceRef:
7 | $ref: resource:/schema/title/title.json
8 | transitiveRelativeClasspathRef:
9 | $ref: java:/schema/ref/classpathRefs2.json
10 | type: object
11 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Diamond.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import java.util.HashMap;
4 | import java.util.HashSet;
5 | import java.util.Map;
6 | import java.util.Set;
7 |
8 | public class Diamond {
9 | Set set1 = new HashSet<>();
10 | void infer() {
11 | Set set2 = new HashSet<>();
12 | Map map = new HashMap<>();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/extendsEmbeddedSchema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyOfChild" : {
5 | "type" : "string"
6 | }
7 | },
8 | "extends" : {
9 | "type" : "object",
10 | "properties" : {
11 | "propertyOfParent" : {
12 | "type" : "string"
13 | }
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/yaml/examples/torrent.yaml:
--------------------------------------------------------------------------------
1 | build: 25053
2 | props:
3 | - dht: 1
4 | dlrate: 0
5 | hash: 71D6FC08482AEF2903C5994C4842455D5C97CD63
6 | pex: 1
7 | seed_override: 0
8 | seed_ratio: 1500
9 | seed_time: 0
10 | superseed: 0
11 | trackers: http://bt.rutracker.org/ann?uk=11111111\r\n\r\nhttp://retracker.local/announce\r\n\r\nhttp://ix.rutracker.net/ann?uk=111111111\r\n
12 | ulrate: 0
13 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/all.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "x" : {
5 | "minimum" : 1.1,
6 | "minimum" : 2.2,
7 | "minItems" : "1",
8 | "maxItems" : "2",
9 | "minLength" : "1",
10 | "maxLength" : "2",
11 | "pattern" : "abc.*",
12 | "required" : true
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/fragmentRefs.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "a" : {
5 | "$ref" : "a.json"
6 | },
7 | "fragmentOfSelf" : {
8 | "$ref" : "#/properties/a"
9 | },
10 | "fragmentOfA" : {
11 | "$ref" : "a.json/#/additionalProperties"
12 | }
13 | },
14 | "additionalProperties" : false
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/refsToA.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "a" : {
5 | "$ref" : "a.json"
6 | },
7 | "arrayOfA" : {
8 | "type" : "array",
9 | "items" : {
10 | "$ref" : "a.json"
11 | }
12 | }
13 | },
14 | "additionalProperties" : {
15 | "$ref" : "a.json"
16 | }
17 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/httpRefs.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | address:
3 | $ref: https://raw.githubusercontent.com/joelittlejohn/jsonschema2pojo/master/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/address.json
4 | refsToA:
5 | $ref: https://raw.githubusercontent.com/joelittlejohn/jsonschema2pojo/master/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/refsToA.json
6 | type: object
7 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Constructors3.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 |
4 | public class Constructors3 {
5 |
6 | class A {
7 | public A(String str) {
8 | }
9 | }
10 |
11 | class B extends A {
12 | public B() {
13 | super("some value");
14 | }
15 |
16 | public B(String str) {
17 | super(str);
18 | }
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/schema/parent.json:
--------------------------------------------------------------------------------
1 | {
2 | "$id": "https://example.com/address.schema.json",
3 | "$schema": "http://json-schema.org/draft-07/schema#",
4 | "description" : "A schema definition for an object which can be inherited",
5 | "javaType" : "com.example.package.GeneratedParentType",
6 | "type" : "object",
7 | "properties" : {
8 | "parentProperty" : { "type" : "string" }
9 | },
10 | "dependencies" : {
11 | }
12 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/ant/example.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.WordDelimit",
4 | "properties" : {
5 | "property_with_underscores" : {
6 | "type" : "string"
7 | },
8 | "property-with-hyphens" : {
9 | "type" : "string"
10 | },
11 | "property_with mixed-delimiters" : {
12 | "type" : "string"
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/required/requiredArray.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "requiredProperty" : {
5 | "type" : "string"
6 | },
7 | "nonRequiredProperty" : {
8 | "type" : "string"
9 | },
10 | "defaultNotRequiredProperty" : {
11 | "type" : "string"
12 | }
13 | },
14 | "required": [ "requiredProperty", ""]
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/properties/initializeCollectionProperties.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | list:
3 | type: array
4 | listWithValues:
5 | default:
6 | - 100
7 | - 200
8 | - 300
9 | type: array
10 | set:
11 | type: array
12 | uniqueItems: true
13 | setWithValues:
14 | default:
15 | - 100
16 | - 200
17 | - 300
18 | type: array
19 | uniqueItems: true
20 | type: object
21 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/propertiesThatAreJavaKeywords.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "public" : {
5 | "type" : "string"
6 | },
7 | "void" : {
8 | "type" : "string"
9 | },
10 | "enum" : {
11 | "type" : "string"
12 | },
13 | "abstract" : {
14 | "type" : "string"
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/type/genericJavaType.yaml:
--------------------------------------------------------------------------------
1 | properties:
2 | a:
3 | javaType: java.util.Map
4 | type: object
5 | b:
6 | javaType: java.util.Map, java.util.List>>
7 | type: object
8 | c:
9 | javaType: java.util.Map
10 | type: object
11 | d:
12 | javaType: java.util.Map
13 | type: object
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Literal.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 |
4 | public class Literal {
5 |
6 | public void doSomething() {
7 | final String s = query("");
8 | System.out.println(s);
9 | }
10 |
11 | public void doSomething2() {
12 | System.out.println(query(""));
13 | }
14 |
15 | private String query(String string) {
16 | return null;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Person.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public abstract class Person {
4 |
5 | private int age = 0;
6 |
7 | public abstract String firstName();
8 |
9 | public final String lastName() {
10 | return "Spiewak";
11 | }
12 |
13 | public synchronized void incrementAge() {
14 | age += 1;
15 | }
16 |
17 | //public native String hardDriveAge();
18 |
19 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/WithStaticAndInstance.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public final class WithStaticAndInstance {
4 |
5 | public static final String CONSTANT = "";
6 |
7 | private String property;
8 |
9 | public String getProperty() {
10 | return property;
11 | }
12 |
13 | public void setProperty(String property) {
14 | this.property = property;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/parcelable/parcelable-superclass-schema-base.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "baseBooleanProperty" : {
5 | "type" : "boolean",
6 | "default": false
7 | },
8 | "baseStringProperty" : {
9 | "type" : "string"
10 | },
11 | "baseIntegerProperty" : {
12 | "type" : "integer"
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/nonStandardRef.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "foo" : {
5 | "$ref" : "#/definitions/com.example.Foo"
6 | }
7 | },
8 | "additionalProperties" : false,
9 | "definitions" : {
10 | "com.example.Foo" : {
11 | "type" : "object",
12 | "properties" : {
13 | "bar" : {
14 | "type" : "string"
15 | }
16 | }
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/regression/extends/AuthMessage.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "extends": {
4 | "type": "object",
5 | "javaType": "org.hawkular.bus.common.BasicMessage"
6 | },
7 | "javaType": "org.abc.AuthMessage",
8 | "additionalProperties": false,
9 | "properties": {
10 | "username": {
11 | "type": "string"
12 | },
13 | "password": {
14 | "type": "string"
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/EqualsHashCode.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class EqualsHashCode {
4 |
5 | // NOTE: override should be added implicitly
6 |
7 | public boolean equals(Object o) {
8 | return false;
9 | }
10 |
11 | public int hashCode() {
12 | return super.hashCode();
13 | }
14 |
15 | public String toString() {
16 | return "";
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/propertiesAreUpperCamelCase.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.UpperCase",
4 | "properties" : {
5 | "Property1" : {
6 | "type" : "string"
7 | },
8 | "PropertyTwo" : {
9 | "type" : "integer"
10 | },
11 | " PropertyThreeWithSpace" : {
12 | "type" : "string"
13 | },
14 | "propertyFour" : {
15 | "type" : "string"
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/required/required.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "requiredProperty" : {
5 | "type" : "string",
6 | "required" : true
7 | },
8 | "nonRequiredProperty" : {
9 | "type" : "string",
10 | "required" : false
11 | },
12 | "defaultNotRequiredProperty" : {
13 | "type" : "string"
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/required/requiredNestedInObject.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "nested": {
5 | "type": "object",
6 | "required": [
7 | "requiredProperty"
8 | ],
9 | "properties": {
10 | "requiredProperty": {
11 | "type": "string"
12 | },
13 | "nonRequiredProperty": {
14 | "type": "string"
15 | }
16 | }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Constructors.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Constructors {
4 |
5 | /**
6 | * skipped javadocs
7 | */
8 | public Constructors() {
9 | this("first", "last");
10 | }
11 |
12 | /**
13 | * available javadocs
14 | *
15 | * @param first
16 | * @param last
17 | */
18 | public Constructors(String first, String last) {
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/complexPropertiesInArrayItem.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "list" : [
4 | {
5 | "a" : 1,
6 | "c" : "hey"
7 | }
8 | ],
9 | "obj" : {
10 | "name" : "k"
11 | }
12 | },
13 | {
14 | "list" : [
15 | {
16 | "b" : 177,
17 | "c" : "hey again"
18 | }
19 | ],
20 | "obj" : {
21 | "index" : 8
22 | }
23 | }
24 | ]
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/parcelable/parcelable-data.json:
--------------------------------------------------------------------------------
1 | {
2 | "booleanProperty" : true,
3 | "stringProperty" : "aaa",
4 | "integerProperty" : 10,
5 | "numberProperty" : 9.945,
6 | "arrayProperty" : [1, 2, 3],
7 | "anyProperty" : {"a" : 1},
8 | "objectProperty" : {"property" : "foo"},
9 | "nonUniqueArray" : [5, 5, 5],
10 | "uniqueArray" : [true, false],
11 | "complexTypesArray" : [{}, {}],
12 | "enumProperty" : "two"
13 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/propertiesWithWordDelimiters.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.WordDelimit",
4 | "properties" : {
5 | "property_with_underscores" : {
6 | "type" : "string"
7 | },
8 | "property-with-hyphens" : {
9 | "type" : "string"
10 | },
11 | "property_with mixed-delimiters" : {
12 | "type" : "string"
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/SwitchCase2.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class SwitchCase2 {
4 |
5 | public void doSmth(int i) {
6 | switch (i) {
7 | case 3:
8 | return;
9 | }
10 | }
11 |
12 | public String doSmthElse(int i) {
13 | switch (i) {
14 | case 3:
15 | return "abc";
16 | default:
17 | return null;
18 | }
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/ParameterDef.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class ParameterDef {
4 |
5 | public static void main(String[] args) {
6 | System.out.println(sum(3, 44));
7 | System.out.println(sum(4, 4, 5, 45, 45));
8 | }
9 |
10 | public static int sum(int ... values) {
11 | int res = 0;
12 | for (int i : values) {
13 | res += i;
14 | }
15 | return res;
16 | }
17 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/validObject.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "primitivefield" : {
5 | "type": "string"
6 | },
7 | "objectfield" : {
8 | "type": "object",
9 | "properties": {
10 | "childprimitivefield" : {
11 | "type": "string",
12 | "maxLength" : 5
13 | }
14 | }
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/schema/child.json:
--------------------------------------------------------------------------------
1 | {
2 | "$id": "https://example.com/child.schema.json",
3 | "$schema": "http://json-schema.org/draft-07/schema#",
4 | "description" : "A schema definition for an object which can be inherited",
5 | "javaType" : "com.example.package.GeneratedChildType",
6 | "type" : "object",
7 | "extends" : {
8 | "$ref" : "parent.json"
9 | },
10 | "properties" : {
11 | "childProperty" : { "type" : "string" }
12 | },
13 | "dependencies" : {
14 | }
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/propertiesAreWithAllWordsUpperCases.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.AllWordsUpperCase",
4 | "properties" : {
5 | "PROPERTY_ONE" : {
6 | "type" : "string"
7 | },
8 | "PROPERTY_ONE_TWO" : {
9 | "type" : "integer"
10 | },
11 | "PROPERTY_ONE_TWO_THREE" : {
12 | "type" : "boolean"
13 | },
14 | "PROPERTY_ONE_TWO_THREE_four" : {
15 | "type" : "string"
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/title/title.json:
--------------------------------------------------------------------------------
1 | {
2 | "title" : "A title for this type",
3 | "type":"object",
4 | "properties" : {
5 | "title" : {
6 | "type" : "string",
7 | "title" : "A title for this property"
8 | },
9 | "titleAndDescription" : {
10 | "type" : "string",
11 | "description" : "A description for this property",
12 | "title" : "A title for this property"
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/dynamic/parentType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "javaType": "com.example.ParentType",
4 | "properties": {
5 | "stringValue": {
6 | "type": "string"
7 | },
8 | "numberValue": {
9 | "type": "number"
10 | },
11 | "integerValue": {
12 | "type": "integer"
13 | },
14 | "enumType": {
15 | "enum": ["one", "two", "three"]
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/IDao.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import java.io.Serializable;
4 |
5 | import javax.annotation.Nullable;
6 |
7 | /**
8 | * @author tiwe
9 | *
10 | * @param
11 | * @param
12 | */
13 | public interface IDao {
14 | /**
15 | * Get the persisted instance with the given id
16 | *
17 | * @param id
18 | * @return
19 | */
20 | @Nullable
21 | Entity getById( Id id );
22 |
23 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Casts.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Casts {
4 |
5 | public static void main(String[] args){
6 | //System.out.println(args.length.toDouble)
7 | System.out.println((double) args.length);
8 | System.out.println((float) args.length);
9 | System.out.println((long) args.length);
10 | System.out.println((short) args.length);
11 | System.out.println((byte) args.length);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/SuperConstructors.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class SuperConstructors extends SuperConstructorsSuperClass {
4 |
5 | public SuperConstructors() {
6 | this("first", "last");
7 | }
8 |
9 | public SuperConstructors(String first, String last) {
10 | super(first);
11 | }
12 |
13 | }
14 |
15 | class SuperConstructorsSuperClass {
16 |
17 | public SuperConstructorsSuperClass(String first) {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Immutable2.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Immutable2 {
4 |
5 | private final String firstName;
6 |
7 | private final String lastName;
8 |
9 | public Immutable2(String f, String l) {
10 | firstName = f;
11 | lastName = l;
12 | }
13 |
14 | public String getFirstName() {
15 | return firstName;
16 | }
17 |
18 | public String getLastName() {
19 | return lastName;
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/constructors/noRequiredPropertiesConstructor.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "type" : {
5 | "type" : "string"
6 | },
7 | "id" : {
8 | "type" : "integer"
9 | },
10 | "has_tickets" : {
11 | "type" : "boolean"
12 | },
13 | "provider" : {
14 | "type" : "string"
15 | },
16 | "starttime" : {
17 | "type" : "string"
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/json/examples/torrent.json:
--------------------------------------------------------------------------------
1 | {"build":25053, "props":[
2 | {
3 | "hash":"71D6FC08482AEF2903C5994C4842455D5C97CD63",
4 | "trackers":"http://bt.rutracker.org/ann?uk=11111111\\r\\n\\r\\nhttp://retracker.local/announce\\r\\n\\r\\nhttp://ix.rutracker.net/ann?uk=111111111\\r\\n",
5 | "ulrate":0,
6 | "dlrate":0,
7 | "superseed":0,
8 | "dht":1,
9 | "pex":1,
10 | "seed_override":0,
11 | "seed_ratio":1500,
12 | "seed_time":0
13 | }
14 | ]}
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/description/description.json:
--------------------------------------------------------------------------------
1 | {
2 | "description" : "A description for this type",
3 | "type":"object",
4 | "properties" : {
5 | "description" : {
6 | "type" : "string",
7 | "description" : "A description for this property"
8 | },
9 | "descriptionAndTitle" : {
10 | "type" : "string",
11 | "description" : "A description for this property",
12 | "title" : "A title for this property"
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Fields.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | public class Fields {
7 |
8 | private Map properties = new HashMap<>();
9 |
10 | public Fields() {
11 | }
12 |
13 | public Fields(Map properties) {
14 | this.properties = properties;
15 | }
16 |
17 | public Map getProperties() {
18 | return properties;
19 | }
20 |
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/httpRefs.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "address" : {
5 | "$ref" : "https://raw.githubusercontent.com/joelittlejohn/jsonschema2pojo/master/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/address.json"
6 | },
7 | "refsToA" : {
8 | "$ref" : "https://raw.githubusercontent.com/joelittlejohn/jsonschema2pojo/master/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/refsToA.json"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Reserved.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Reserved {
4 |
5 | String type = "a";
6 | String var = "b";
7 | String val = "c";
8 | String object = "d";
9 | String def = "d";
10 |
11 | public void reservedWords() {
12 | String type = "a";
13 | String var = "b";
14 | String val = "c";
15 | String object = "d";
16 | String def = "d";
17 | System.err.println(type + var + val + object + def);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/required/requiredNestedInArray.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "nested": {
5 | "type": "array",
6 | "items": {
7 | "type": "object",
8 | "required": [
9 | "requiredProperty"
10 | ],
11 | "properties": {
12 | "requiredProperty": {
13 | "type": "string"
14 | },
15 | "nonRequiredProperty": {
16 | "type": "string"
17 | }
18 | }
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/selfRefs.yaml:
--------------------------------------------------------------------------------
1 | additionalProperties:
2 | $ref: '#'
3 | definitions:
4 | embedded:
5 | properties:
6 | embeddedProp:
7 | $ref: '#/definitions/embedded2'
8 | type: object
9 | embedded2:
10 | properties:
11 | embeddedProp2:
12 | $ref: '#'
13 | type: object
14 | properties:
15 | arrayOfSelf:
16 | items:
17 | $ref: '#'
18 | type: array
19 | childOfSelf:
20 | $ref: '#'
21 | embeddedInSelf:
22 | $ref: '#/definitions/embedded'
23 | type: object
24 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/androidTest/java/jsonschema2pojo/joelittlejohn/github/com/androidexample/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package jsonschema2pojo.joelittlejohn.github.com.androidexample;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase
10 | {
11 | public ApplicationTest()
12 | {
13 | super(Application.class);
14 | }
15 | }
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright © 2010-2017 Nokia
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/classpathRefs.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyClasspathRef" : {
5 | "$ref" : "classpath:/schema/ref/a.json"
6 | },
7 | "propertyResourceRef" : {
8 | "$ref" : "resource:/schema/title/title.json"
9 | },
10 | "propertyJavaRef" : {
11 | "$ref" : "java:/schema/description/description.json"
12 | },
13 | "transitiveRelativeClasspathRef" : {
14 | "$ref" : "java:/schema/ref/classpathRefs2.json"
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/nestedSelfRefsReadAsString.yaml:
--------------------------------------------------------------------------------
1 | definitions:
2 | Name:
3 | type: string
4 | Namespace:
5 | type: string
6 | Thing:
7 | properties:
8 | name:
9 | $ref: '#/definitions/Name'
10 | namespace:
11 | $ref: '#/definitions/Namespace'
12 | version:
13 | $ref: '#/definitions/Version'
14 | ThingList:
15 | items:
16 | $ref: '#/definitions/Thing'
17 | type: array
18 | Version:
19 | type: string
20 | properties:
21 | things:
22 | $ref: '#/definitions/ThingList'
23 | type: object
24 |
--------------------------------------------------------------------------------
/jsonschema2pojo-ant/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright © 2010-2017 Nokia
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-cli/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright © 2010-2017 Nokia
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright © 2010-2017 Nokia
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/excludedFromEqualsAndHashCode/excludedFromEqualsAndHashCode.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "excludedFromEqualsAndHashCode" : [ "excludedByArray" ],
4 | "properties": {
5 | "notExcluded" : {
6 | "type" : "string"
7 | },
8 | "excludedByProperty" : {
9 | "type" : "string",
10 | "excludedFromEqualsAndHashCode" : true
11 | },
12 | "notExcludedByProperty" : {
13 | "type" : "string",
14 | "excludedFromEqualsAndHashCode" : false
15 | },
16 | "excludedByArray" : {
17 | "type" : "string"
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright © 2010-2017 Nokia
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright © 2010-2017 Nokia
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright © 2010-2017 Nokia
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Asserts.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import com.mysema.commons.lang.Assert;
4 |
5 | public class Asserts {
6 |
7 | private final String firstName, lastName;
8 |
9 | public Asserts(String firstName, String lastName) {
10 | this.firstName = Assert.notNull(firstName, "firstName");
11 | this.lastName = Assert.notNull(lastName, "lastName");
12 | }
13 |
14 | public String getFirstName() {
15 | return firstName;
16 | }
17 |
18 | public String getLastName() {
19 | return lastName;
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/ant/exampleWithExtraClasspath.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "javaType" : "com.example.WordDelimit",
4 | "properties" : {
5 | "property_with_underscores" : {
6 | "type" : "string"
7 | },
8 | "property-with-hyphens" : {
9 | "type" : "string"
10 | },
11 | "property_with mixed-delimiters" : {
12 | "type" : "string"
13 | },
14 | "property-refer-custom-classpath" : {
15 | "type" : "object",
16 | "javaType" : "de.flapdoodle.embedmongo.Paths"
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/orderedProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "type" : {
5 | "type" : "string",
6 | "default" : "event"
7 | },
8 | "id" : {
9 | "type" : "string"
10 | },
11 | "name" : {
12 | "type" : "string"
13 | },
14 | "hastickets" : {
15 | "type" : "boolean"
16 | },
17 | "provider" : {
18 | "type" : "string"
19 | },
20 | "starttime" : {
21 | "type" : "string"
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/toString/scalarTypes.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "stringField": {
5 | "type": "string"
6 | },
7 | "numberField": {
8 | "type": "number"
9 | },
10 | "integerField": {
11 | "type": "integer"
12 | },
13 | "booleanField": {
14 | "type": "boolean"
15 | },
16 | "nullField": {
17 | "type": "null"
18 | },
19 | "bytesField": {
20 | "type": "string",
21 | "media" : {
22 | "binaryEncoding": "base64"
23 | }
24 | }
25 | },
26 | "additionalProperties": false
27 | }
28 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/constructors/requiredArrayPropertyConstructors.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "type" : {
5 | "type" : "string",
6 | "default" : "event"
7 | },
8 | "id" : {
9 | "type" : "integer"
10 | },
11 | "has_tickets" : {
12 | "type" : "boolean"
13 | },
14 | "provider" : {
15 | "type" : "string"
16 | },
17 | "starttime" : {
18 | "type" : "string"
19 | }
20 | },
21 | "required": [ "type", "id", "has_tickets" ]
22 | }
23 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/properties/initializeCollectionProperties.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "type" : "object",
4 | "properties" : {
5 | "list" :{
6 | "type" : "array"
7 | },
8 | "set" :{
9 | "type" : "array",
10 | "uniqueItems": true
11 | },
12 | "listWithValues": {
13 | "type" : "array",
14 | "default" : [100, 200, 300]
15 | },
16 | "setWithValues": {
17 | "type" : "array",
18 | "uniqueItems": true,
19 | "default" : [100, 200, 300]
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/extends/extendsSchemaWithinDefinitions.json:
--------------------------------------------------------------------------------
1 | {
2 | "definitions": {
3 | "parent": {
4 | "type": "object",
5 | "properties": {
6 | "propertyOfParent": {
7 | "type": "string"
8 | }
9 | }
10 | },
11 | "child": {
12 | "type": "object",
13 | "extends": {"$ref": "#/definitions/parent"},
14 | "properties": {
15 | "propertyOfChild": {
16 | "type": "string"
17 | }
18 | }
19 | }
20 | },
21 | "type": "object",
22 | "properties": {
23 | "child": {"$ref": "#/definitions/child"}
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/PrimitiveInits.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class PrimitiveInits {
4 |
5 | double a = 3;
6 |
7 | void doSomething() {
8 | // byte
9 | byte b = 0;
10 | // char
11 | char c = 0;
12 | // int
13 | int i = 2;
14 | // long
15 | long l1 = 1;
16 | long l2 = 2l;
17 | // float
18 | float f1 = 3f;
19 | float f2 = 3;
20 | // double
21 | double d1 = 2d;
22 | double d2 = 2.0;
23 | double d3 = 2;
24 | System.out.println(a + d1);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/parcelable/parcelable-superclass-schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "extends": {
4 | "$ref": "parcelable-superclass-schema-base.json"
5 | },
6 | "properties" : {
7 | "booleanProperty" : {
8 | "type" : "boolean"
9 | },
10 | "stringProperty" : {
11 | "type" : "string"
12 | },
13 | "integerProperty" : {
14 | "type" : "integer"
15 | },
16 | "baseIntegerProperty": {
17 | "title": "Tests overriding of property",
18 | "type": "integer"
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Concatenation.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Concatenation {
4 |
5 | public static String f(String arg1) {
6 | return arg1;
7 | }
8 |
9 | private static String f(String arg1, String arg2, String arg3) {
10 | return arg1;
11 | }
12 |
13 | public static void main(String[] args) {
14 | String sep = ";";
15 | String title = "abc".toLowerCase() + ":" + f(sep) + ", fdsa="
16 | + ", ma " + f(sep) +
17 | args[0] + f(args[0], sep, args[1]);
18 | System.out.println(title);
19 | }
20 |
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/constructors/requiredPropertyConstructors.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "type" : {
5 | "type" : "string",
6 | "default" : "event",
7 | "required": true
8 | },
9 | "id" : {
10 | "type" : "integer",
11 | "required": true
12 | },
13 | "has_tickets" : {
14 | "type" : "boolean",
15 | "required": true
16 | },
17 | "provider" : {
18 | "type" : "string"
19 | },
20 | "starttime" : {
21 | "type" : "string"
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | generate
7 |
8 |
9 |
10 |
11 | false
12 | true
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Bean3.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import java.util.List;
4 |
5 | public class Bean3 extends Superclass{
6 |
7 | private List names;
8 |
9 | public Bean3(List n) {
10 | super(n.toString());
11 | this.names = n;
12 | }
13 |
14 | public List getNames() {
15 | return names;
16 | }
17 |
18 | public void setNames(List names) {
19 | this.names = names;
20 | }
21 |
22 | }
23 |
24 |
25 | class Superclass {
26 |
27 | public Superclass(String s) {
28 | // TODO Auto-generated constructor stub
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/toString/compositeTypes.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "mapField": {
5 | "type": "object",
6 | "existingJavaType" : "java.util.Map"
7 | },
8 | "objectField": {
9 | "$ref": "intPair.json"
10 | },
11 | "arrayField": {
12 | "type": "array",
13 | "items": {
14 | "$ref": "intPair.json"
15 | }
16 | },
17 | "uniqueArrayField": {
18 | "type": "array",
19 | "uniqueItems": true,
20 | "items": {
21 | "$ref": "intPair.json"
22 | }
23 | }
24 | },
25 | "additionalProperties": false
26 | }
27 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/javaName/javaName.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "propertyWithJavaName" : {
5 | "javaName" : "javaProperty",
6 | "type" : "string"
7 | },
8 | "propertyWithoutJavaName" : {
9 | "type" : "string"
10 | },
11 | "enumWithJavaName" : {
12 | "javaName" : "javaEnum",
13 | "enum" : [ "a", "b" ]
14 | },
15 | "enumWithoutJavaName" : {
16 | "enum" : [ "c", "d" ]
17 | },
18 | "objectWithJavaName" : {
19 | "javaName" : "javaObject",
20 | "type" : "object"
21 | },
22 | "objectWithoutJavaName" : {
23 | "type" : "object"
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/yaml/ref/address.yaml:
--------------------------------------------------------------------------------
1 | dependencies:
2 | extended-address: street-address
3 | locality: region
4 | post-office-box: street-address
5 | region: country-name
6 | street-address: region
7 | description: An Address following the convention of http://microformats.org/wiki/hcard
8 | properties:
9 | country-name:
10 | required: true
11 | type: string
12 | extended-address:
13 | type: string
14 | locality:
15 | required: true
16 | type: string
17 | post-office-box:
18 | type: string
19 | postal-code:
20 | type: string
21 | region:
22 | required: true
23 | type: string
24 | street-address:
25 | type: string
26 | type: object
27 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Bag2.java:
--------------------------------------------------------------------------------
1 |
2 | package com.mysema.examples;
3 |
4 | import java.lang.reflect.Type;
5 | import java.util.ArrayList;
6 | import java.util.HashMap;
7 |
8 | public abstract class Bag2 {
9 |
10 | private HashMap nameTable;
11 |
12 | private ArrayList> itemTable;
13 |
14 | private int capacity;
15 |
16 | private int mass;
17 |
18 | private int levelIndex;
19 |
20 | private int currentLevel;
21 |
22 | private int currentCounter;
23 |
24 | private boolean showing;
25 |
26 | protected abstract int capacity();
27 |
28 | protected abstract int forgetRate();
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Returns.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Returns {
4 |
5 | public int shouldPrintReturns(int start, int n) {
6 | for (int i = start; i < n; ++i)
7 | if (i / 5 > 1)
8 | return i;
9 | return -1;
10 | }
11 |
12 | public void shouldPrintReturns2(int start, int n) {
13 | for (int i = start; i < n; ++i)
14 | if (i / 5 > 1) {
15 | doSomething(i);
16 | return;
17 | }
18 | }
19 |
20 | public void doSomething(int n) {
21 |
22 | }
23 |
24 | public boolean shouldNotPrintReturns(boolean bool) {
25 | return bool;
26 | }
27 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/sduke/Android-SDK/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/java/src/main/resources/json/address.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "An Address following the convention of http://microformats.org/wiki/hcard",
3 | "type": "object",
4 | "properties": {
5 | "post_office_box": { "type": "string" },
6 | "extended_address": { "type": "string" },
7 | "street_address": { "type": "string" },
8 | "locality":{ "type": "string", "required": true },
9 | "region": { "type": "string", "required": true },
10 | "postal_code": { "type": "string" },
11 | "country_name": { "type": "string", "required": true},
12 | "address": {"type": "array", "items": "string"}
13 | },
14 | "dependencies": {
15 | "post_office_box": "street_address",
16 | "extended_address": "street_address"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/lib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /opt/android/android-sdk-linux/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/hashCodeAndEquals/types.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "empty" : {
5 | "type" : "object"
6 | },
7 | "extendsJavaType" : {
8 | "type" : "object",
9 | "extendsJavaClass" : "org.jsonschema2pojo.integration.config.IncludeHashCodeAndEqualsIT.Parent"
10 | },
11 | "extendsJavaTypeWithEquals" : {
12 | "type" : "object",
13 | "extendsJavaClass" : "org.jsonschema2pojo.integration.config.IncludeHashCodeAndEqualsIT.ParentWithEquals"
14 | },
15 | "extendsFalseObject" : {
16 | "type" : "object",
17 | "extendsJavaClass" : "org.jsonschema2pojo.integration.config.IncludeHashCodeAndEqualsIT.Object"
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Switch.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Switch {
4 |
5 | public static void method1() {
6 | switch (42) {
7 | default: System.out.println(42);
8 | }
9 | System.out.println("Hello World!");
10 | }
11 |
12 | public static void method2() {
13 | System.out.println("Hello World!");
14 | switch (42) {
15 | default: System.out.println(42);
16 | }
17 | }
18 |
19 | public static void method3() {
20 | switch (42) {
21 | default: System.out.println(42);
22 | }
23 | }
24 |
25 | public static void method4() {
26 | System.out.println("Hello World!");
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/java/com/example/MyJsonViewClass.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.example;
18 |
19 | public class MyJsonViewClass {}
20 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/nestedSelfRefsReadAsString.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "definitions": {
4 | "Namespace": {
5 | "type": "string"
6 | },
7 | "Name": {
8 | "type": "string"
9 | },
10 | "Version": {
11 | "type": "string"
12 | },
13 | "Thing": {
14 | "properties": {
15 | "namespace": { "$ref": "#/definitions/Namespace" },
16 | "name": { "$ref": "#/definitions/Name" },
17 | "version": { "$ref": "#/definitions/Version"}
18 | }
19 | },
20 | "ThingList": {
21 | "type": "array",
22 | "items": { "$ref": "#/definitions/Thing" }
23 | }
24 | },
25 | "type": "object",
26 | "properties": {
27 | "things": { "$ref": "#/definitions/ThingList" }
28 | }
29 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/IfElse.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | public class IfElse {
7 |
8 | public void ifElse() {
9 | String property = "x";
10 | if (System.currentTimeMillis() > 0) {
11 | property = "y";
12 | } else {
13 | property = "z";
14 | }
15 | System.out.println(property);
16 | }
17 |
18 | public void ifElse2() {
19 | boolean success;
20 | List list = new ArrayList<>();
21 | list.add(1);
22 | list.add(2);
23 | if (list.size() == 2) {
24 | success = true;
25 | } else {
26 | success = false;
27 | }
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Immutable.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Immutable {
4 |
5 | public static void main(String[] args) {
6 | Immutable immutable = new Immutable("John", "Doe");
7 | System.out.println(immutable.getFirstName());
8 | System.out.println(immutable.getLastName());
9 | }
10 |
11 | private final String firstName;
12 |
13 | private final String lastName;
14 |
15 | public Immutable(String firstName, String lastName) {
16 | this.firstName = firstName;
17 | this.lastName = lastName;
18 | }
19 |
20 | public String getFirstName() {
21 | return firstName;
22 | }
23 |
24 | public String getLastName() {
25 | return lastName;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/jsonschema2pojo-cli/src/main/scripts/jsonschema2pojo.bat:
--------------------------------------------------------------------------------
1 | @REM
2 | @REM Copyright © 2010-2014 Nokia
3 | @REM
4 | @REM Licensed under the Apache License, Version 2.0 (the "License");
5 | @REM you may not use this file except in compliance with the License.
6 | @REM You may obtain a copy of the License at
7 | @REM
8 | @REM http://www.apache.org/licenses/LICENSE-2.0
9 | @REM
10 | @REM Unless required by applicable law or agreed to in writing, software
11 | @REM distributed under the License is distributed on an "AS IS" BASIS,
12 | @REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @REM See the License for the specific language governing permissions and
14 | @REM limitations under the License.
15 | @REM
16 |
17 | @echo off
18 | java -jar "%~dp0/../lib/${project.build.finalName}.jar" %*
19 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Language.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo;
18 |
19 | public enum Language {
20 |
21 | JAVA, SCALA
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/jsonschema2pojo-cli/src/main/scripts/jsonschema2pojo.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Copyright © 2010-2014 Nokia
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | SCRIPT=$(readlink -f "$0")
19 | SCRIPTPATH=$(dirname "$SCRIPT")
20 |
21 | java -jar ${SCRIPTPATH}/../lib/${project.build.finalName}.jar "$@"
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/yaml/YamlRefIT.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.integration.yaml;
18 |
19 | public class YamlRefIT {
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Bean4.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Bean4 {
4 |
5 | public static class T1 {}
6 |
7 | public static class C {
8 | private T1 prop;
9 |
10 | C(T1 prop) {
11 | setProp(prop);
12 | }
13 |
14 | public void setProp(T1 prop) {
15 | this.prop = prop;
16 | }
17 |
18 | public T1 getProp() {
19 | return prop;
20 | }
21 | }
22 |
23 | public static class D {
24 | private T1 prop;
25 |
26 | D(T1 prop) {
27 | this.prop = prop;
28 | }
29 |
30 | public void setProp(T1 prop) {
31 | this.prop = prop;
32 | }
33 |
34 | public T1 getProp() {
35 | return prop;
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Provides the classes specifically associated with the Ant task for
19 | * jsonschema2pojo
20 | */
21 | package org.jsonschema2pojo.ant;
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/SelectedText.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 |
5 | public class SelectedText {
6 |
7 | private String selection;
8 |
9 | public SelectedText(){}
10 |
11 | public SelectedText(String selection) {
12 | this.selection = selection;
13 | }
14 |
15 | public String getSelection() {
16 | return selection;
17 | }
18 |
19 | public void setSelection(String selection) {
20 | this.selection = selection;
21 | }
22 |
23 | public String getFirstWord(){
24 | String[] words = StringUtils.split(selection);
25 | return words[0];
26 | }
27 |
28 | public String getLastWord(){
29 | String[] words = StringUtils.split(selection);
30 | return words[words.length-1];
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/schema/address.json:
--------------------------------------------------------------------------------
1 | {
2 | "description" : "An Address following the convention of http://microformats.org/wiki/hcard",
3 | "type" : "object",
4 | "properties" : {
5 | "post-office-box" : { "type" : "string" },
6 | "extended-address" : { "type" : "string" },
7 | "street-address" : { "type":"string" },
8 | "locality" : { "type" : "string", "required" : true },
9 | "region" : { "type" : "string", "required" : true },
10 | "postal-code" : { "type" : "string" },
11 | "country-name" : { "type" : "string", "required" : true }
12 | },
13 | "dependencies" : {
14 | "post-office-box" : "street-address",
15 | "extended-address" : "street-address",
16 | "street-address" : "region",
17 | "locality" : "region",
18 | "region" : "country-name"
19 | }
20 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-maven-plugin/src/main/java/org/jsonschema2pojo/maven/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Provides the classes specifically associated with the Maven plugin for
19 | * jsonschema2pojo
20 | */
21 | package org.jsonschema2pojo.maven;
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/scalagen/HelpersTest.scala:
--------------------------------------------------------------------------------
1 | package com.mysema.scalagen
2 |
3 | //import japa.parser.ast.`type`._
4 | import org.junit.Test
5 | import org.junit.Assert._
6 | import UnitTransformer._
7 | import java.util.Collections
8 |
9 | class HelpersTest {
10 |
11 | val helpers = new AnyRef with Helpers
12 |
13 | @Test
14 | def IsHashCode {
15 | val method = new Method(0, Type.Int, "hashCode", null)
16 | assertTrue(helpers.isHashCode(method))
17 | }
18 |
19 | @Test
20 | def IsEquals {
21 | val method = new Method(0, Type.Boolean, "equals", Collections.singletonList[Parameter](new Parameter))
22 | assertTrue(helpers.isEquals(method))
23 | }
24 |
25 | @Test
26 | def ToString {
27 | val method = new Method(0, Type.String, "toString", null)
28 | assertTrue(helpers.isToString(method))
29 | }
30 |
31 |
32 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Provides the classes specifically associated with the command line interface
19 | * for jsonschema2pojo
20 | */
21 | package org.jsonschema2pojo.cli;
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/exception/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Provides exception types, thrown during schema parsing or code generation
19 | * when errors occur
20 | */
21 | package org.jsonschema2pojo.exception;
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/address.json:
--------------------------------------------------------------------------------
1 | {
2 | "description" : "An Address following the convention of http://microformats.org/wiki/hcard",
3 | "type" : "object",
4 | "properties" : {
5 | "post-office-box" : { "type" : "string" },
6 | "extended-address" : { "type" : "string" },
7 | "street-address" : { "type":"string" },
8 | "locality" : { "type" : "string", "required" : true },
9 | "region" : { "type" : "string", "required" : true },
10 | "postal-code" : { "type" : "string" },
11 | "country-name" : { "type" : "string", "required" : true }
12 | },
13 | "dependencies" : {
14 | "post-office-box" : "street-address",
15 | "extended-address" : "street-address",
16 | "street-address" : "region",
17 | "locality" : "region",
18 | "region" : "country-name"
19 | }
20 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Provides the schema rules which can be 'applied' to perform the code
19 | * generation steps associated with JSON schema nodes
20 | */
21 | package org.jsonschema2pojo.rules;
22 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/java/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'jsonschema2pojo'
3 |
4 | buildscript {
5 | repositories {
6 | mavenLocal()
7 | jcenter()
8 | }
9 |
10 | dependencies {
11 | classpath 'org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:latest.integration'
12 |
13 | // see src/main/resources/json/external_dependencies.json
14 | classpath 'joda-time:joda-time:2.2'
15 | }
16 | }
17 |
18 | repositories {
19 | mavenCentral()
20 | }
21 |
22 | dependencies {
23 | compile 'javax.validation:validation-api:1.1.0.CR2'
24 | compile 'com.fasterxml.jackson.core:jackson-databind:2.9.7'
25 |
26 | // see src/main/resources/json/external_dependencies.json
27 | compile 'joda-time:joda-time:2.2'
28 | }
29 |
30 | jsonSchema2Pojo {
31 | targetPackage = 'example'
32 | includeJsr303Annotations = true
33 | propertyWordDelimiters = ['_'] as char[]
34 | }
35 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/ArrayTests.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class ArrayTests {
4 |
5 | int[] foo() {
6 | return new int[2];
7 | }
8 |
9 | void bar() {
10 | // var foo:Array[Object] = Array[Object](new Object())
11 | // var bar:Array[char] = Array('f', 'o', 'o')
12 | Object[] foo = new Object[] { new Object() };
13 | char[] bar = new char[] { 'f', 'o', 'o' };
14 | }
15 |
16 | void bar2() {
17 | String el1s[] = new String[]{"a","b"};
18 | String el2s[] = new String[]{"a","b","c"};
19 | }
20 |
21 | void bar3() {
22 | final int SIZE = 3;
23 | String strings1[];
24 | strings1 = new String[SIZE];
25 | }
26 |
27 | void bar4() {
28 | final int SIZE = 3;
29 | String[] strings2;
30 | strings2 = new String[SIZE];
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/type/genericJavaType.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "a" : {
5 | "type": "object",
6 | "existingJavaType" : "java.util.Map"
7 | },
8 | "b" : {
9 | "type" : "object",
10 | "existingJavaType" : "java.util.Map, java.util.List>>"
11 | },
12 | "c" : {
13 | "type" : "object",
14 | "existingJavaType" : "java.util.Map"
15 | },
16 | "d" : {
17 | "existingJavaType" : "java.util.Map"
18 | },
19 | "e" : {
20 | "existingJavaType" : "java.util.Map"
21 | },
22 | "f" : {
23 | "existingJavaType" : "java.util.Map"
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Concept.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public final class Concept extends Item {
4 |
5 | private Object term;
6 | private Object memory;
7 |
8 | // XXX this signature fails
9 | // public Concept(Object tm, Object memory)
10 | public Concept(Object term, Object memory) {
11 | super(term.toString());
12 | this.term = term;
13 | this.memory = memory;
14 | }
15 |
16 | public Object getTerm() {
17 | return term;
18 | }
19 |
20 | public void setTerm(Object term) {
21 | this.term = term;
22 | }
23 |
24 | public Object getMemory() {
25 | return memory;
26 | }
27 |
28 | public void setMemory(Object memory) {
29 | this.memory = memory;
30 | }
31 |
32 | }
33 |
34 | class Item {
35 |
36 | public Item(String str) {
37 | // TODO Auto-generated constructor stub
38 | }
39 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/javaName/javaNameWithRequiredProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "required" : [ "requiredPropertyWithJavaName", "requiredPropertyWithoutJavaName" ],
4 | "properties" : {
5 | "notRequiredPropertyWithJavaName" : {
6 | "javaName" : "notRequiredJavaProperty",
7 | "type" : "string"
8 | },
9 | "notRequiredPropertyWithoutJavaName" : {
10 | "type" : "string"
11 | },
12 | "requiredPropertyWithJavaName" : {
13 | "javaName" : "requiredJavaProperty",
14 | "type" : "string"
15 | },
16 | "requiredPropertyWithoutJavaName" : {
17 | "type" : "string"
18 | },
19 | "inlineRequiredPropertyWithJavaName" : {
20 | "javaName" : "inlineRequiredJavaProperty",
21 | "type" : "string",
22 | "required" : true
23 | },
24 | "inlineRequiredPropertyWithoutJavaName" : {
25 | "type" : "string",
26 | "required" : true
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/InnerClasses.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | @SuppressWarnings("unused")
4 | public class InnerClasses {
5 |
6 | public static class StaticClass {
7 |
8 | }
9 |
10 | private static class PrivateStaticClass {
11 |
12 | }
13 |
14 | private class PrivateClass {
15 |
16 | }
17 |
18 | public class PublicClass {
19 |
20 | }
21 |
22 | private static final class LoopContext {
23 | private String note;
24 | private String text;
25 | private String paragraphs;
26 | private int counter;
27 | private boolean inBib;
28 | private boolean inA;
29 | private String reference;
30 | private String url;
31 |
32 | private LoopContext() {
33 | note = null;
34 | text = null;
35 | counter = 0;
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/jsonschema2pojo-ant/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | jsonschema2pojo
7 | org.jsonschema2pojo
8 | 1.0.2-SNAPSHOT
9 |
10 |
11 | jsonschema2pojo-ant
12 |
13 | jsonschema2pojo-ant
14 |
15 |
16 |
17 | org.jsonschema2pojo
18 | jsonschema2pojo-core
19 | ${project.version}
20 |
21 |
22 | org.apache.ant
23 | ant
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/NoopAnnotator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo;
18 |
19 |
20 | /**
21 | * No-op annotator that produces no annotations. Useful for producing truly
22 | * plain old Java types that have no mapping annotations at all.
23 | */
24 | public class NoopAnnotator extends AbstractAnnotator {
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/wiremock/mappings/address.json:
--------------------------------------------------------------------------------
1 | {
2 | "request": {
3 | "method": "GET",
4 | "url": "/address.json"
5 | },
6 | "response": {
7 | "status": 200,
8 | "body": "{\n\"description\" : \"An Address following the convention of http://microformats.org/wiki/hcard\",\n\"type\" : \"object\",\n\"properties\" : {\n\"post-office-box\" : { \"type\" : \"string\" },\n\"extended-address\" : { \"type\" : \"string\" },\n\"street-address\" : { \"type\":\"string\" },\n\"locality\" : { \"type\" : \"string\", \"required\" : true },\n\"region\" : { \"type\" : \"string\", \"required\" : true },\n\"postal-code\" : { \"type\" : \"string\" },\n\"country-name\" : { \"type\" : \"string\", \"required\" : true }\n},\n\"dependencies\" : {\n\"post-office-box\" : \"street-address\",\n\"extended-address\" : \"street-address\",\n\"street-address\" : \"region\",\n\"locality\" : \"region\",\n\"region\" : \"country-name\"}\n}",
9 | "headers": {
10 | "Content-Type": "application/json"
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/scalagen/ReturnsTest.scala:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011, Mysema Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.scalagen
15 |
16 | import org.junit.Test
17 | import org.junit.Assert._
18 |
19 | class ReturnsTest {
20 |
21 | @Test
22 | def test {
23 | assertEquals(-1, printReturns())
24 | }
25 |
26 | def printReturns(): Int = {
27 | for (i <- 0 until 10 if i > 2) i
28 | -1
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/ref/selfRefs.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "childOfSelf" : {
5 | "$ref" : "#"
6 | },
7 | "arrayOfSelf" : {
8 | "type" : "array",
9 | "items" : {
10 | "$ref" : "#"
11 | }
12 | },
13 | "embeddedInSelf" : {
14 | "$ref" : "#/definitions/embedded"
15 | }
16 | },
17 | "additionalProperties" : {
18 | "$ref" : "#"
19 | },
20 | "definitions" : {
21 | "embedded" : {
22 | "type" : "object",
23 | "properties" : {
24 | "embeddedProp" : {
25 | "$ref" : "#/definitions/embedded2"
26 | }
27 | }
28 | },
29 | "embedded2" : {
30 | "type" : "object",
31 | "properties" : {
32 | "embeddedProp2" : {
33 | "$ref" : "#"
34 | }
35 | }
36 | }
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Loop.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Loop {
4 |
5 | boolean condition_and_early_return_dont_contain_b(String str) {
6 | for (String b : java.util.Arrays.asList("a", "b")) {
7 | if (str.startsWith("a")) {
8 | return true;
9 | }
10 | }
11 | return false;
12 | }
13 |
14 | boolean condition_and_early_return_contain_b_once(String str) {
15 | for (String b : java.util.Arrays.asList("a", "b")) {
16 | if (str.startsWith(b)) {
17 | return b.length() > 0;
18 | }
19 | }
20 | return false;
21 | }
22 |
23 | boolean condition_and_early_return_contain_b_multiple_times(String str) {
24 | for (String b : java.util.Arrays.asList("a", "b")) {
25 | if (str.startsWith(b) && b.length() < 10) {
26 | return b.length() > 0 || b.length() < 15;
27 | }
28 | }
29 | return false;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AllFileFilter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo;
18 |
19 | import java.io.File;
20 | import java.io.FileFilter;
21 |
22 | /**
23 | * A file filter that accepts all files.
24 | *
25 | * @author Christian Trimble
26 | *
27 | */
28 | public class AllFileFilter implements FileFilter {
29 |
30 | @Override
31 | public boolean accept(File arg0) {
32 | return true;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/enum/multipleEnumArraysWithSameName.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "properties": {
4 | "foo": {
5 | "type": "object",
6 | "properties": {
7 | "statuses": {
8 | "type": "array",
9 | "items": {
10 | "type": "string",
11 | "enum": [
12 | "open",
13 | "closed"
14 | ]
15 | }
16 | }
17 | }
18 | },
19 | "bar": {
20 | "type": "object",
21 | "properties": {
22 | "statuses": {
23 | "type": "array",
24 | "items": {
25 | "type": "string",
26 | "enum": [
27 | "open",
28 | "closed"
29 | ]
30 | }
31 | }
32 | }
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/media/mediaProperties.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "minimalBinary" : {
5 | "type" : "string",
6 | "media" : {
7 | "binaryEncoding": "base64"
8 | }
9 | },
10 | "anyBinaryEncoding" : {
11 | "type" : "string",
12 | "media" : {
13 | "binaryEncoding" : "quoted-printable"
14 | }
15 | },
16 | "unencoded" : {
17 | "type" : "string",
18 | "media" : {
19 | "type" : "text/plain"
20 | }
21 | },
22 | "unencodedWithDefault" : {
23 | "type" : "string",
24 | "default": "default value",
25 | "media" : {
26 | "type" : "text/plain"
27 | }
28 | },
29 | "withUriFormat" : {
30 | "type" : "string",
31 | "format": "uri",
32 | "media" : {
33 | "binaryEncoding": "base64"
34 | }
35 | },
36 | "base64WithDefault" : {
37 | "type" : "string",
38 | "default": "//APAA==",
39 | "media" : {
40 | "binaryEncoding": "base64"
41 | }
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scalagen/ScalaVersion.scala:
--------------------------------------------------------------------------------
1 | package com.mysema.scalagen
2 |
3 | import scala.util.{Properties => ScalaProperties}
4 |
5 | sealed abstract class ScalaVersion(val sortOrder: Int) extends Ordered[ScalaVersion] {
6 | def compare(that: ScalaVersion): Int = sortOrder.compare(that.sortOrder)
7 | }
8 |
9 | case object Scala29 extends ScalaVersion(0)
10 |
11 | case object Scala210 extends ScalaVersion(1)
12 |
13 | case object Scala211 extends ScalaVersion(2)
14 |
15 | object ScalaVersion {
16 | lazy val current = {
17 | //we can't use ScalaProperties.scalaVersionNumber because it's new in 2.10
18 | val scalaVersionNumber = ScalaProperties.versionString.drop("version ".length)
19 | getVersion(scalaVersionNumber)
20 | }
21 |
22 | def getVersion(versionNumberString: String) = {
23 | if (versionNumberString.startsWith("2.9.")) Scala29
24 | else if (versionNumberString.startsWith("2.10.")) Scala210
25 | else if (versionNumberString.startsWith("2.11.")) Scala211
26 | else throw new IllegalArgumentException("Unsupported scala version: " + versionNumberString)
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/jsr303/validArray.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "primitivearray" : {
5 | "type": "array",
6 | "items": {
7 | "type": "string"
8 | }
9 | },
10 | "objectarray" : {
11 | "type": "array",
12 | "items": {
13 | "type": "object",
14 | "properties": {
15 | "arrayitem":{
16 | "type": "string",
17 | "maxLength" : 5
18 | }
19 | }
20 | }
21 | },
22 | "refarray" : {
23 | "type": "array",
24 | "items": {
25 | "$ref": "#definitions/product"
26 | }
27 | }
28 | },
29 | "definitions": {
30 | "product": {
31 | "type": "object",
32 | "properties": {
33 | "arrayitem":{
34 | "type": "string",
35 | "maxLength" : 5
36 | }
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scala/BeanUtils.scala:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011, Mysema Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.scala
15 |
16 | import java.beans.Introspector
17 | import org.apache.commons.lang3.StringUtils
18 |
19 | object BeanUtils {
20 |
21 | def capitalize(name: String): String = {
22 | if (name.length > 1 && Character.isUpperCase(name.charAt(1))) {
23 | name
24 | } else {
25 | StringUtils.capitalize(name)
26 | }
27 | }
28 |
29 | def uncapitalize(name: String): String = Introspector.decapitalize(name);
30 |
31 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/BagWindow.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | import java.awt.event.ActionEvent;
4 | import java.awt.event.ActionListener;
5 | import java.awt.event.AdjustmentEvent;
6 | import java.awt.event.AdjustmentListener;
7 |
8 | public class BagWindow extends BagWindowSuper implements ActionListener, AdjustmentListener {
9 |
10 | private Bag> bag;
11 |
12 | private String str;
13 |
14 | private int showLevel;
15 |
16 | public BagWindow(Bag> b, String title) {
17 | super(title);
18 | bag = b;
19 | str = "abc";
20 | adjustmentValueChanged(null);
21 | }
22 |
23 | public int showLevel() {
24 | return showLevel;
25 | }
26 |
27 | @Override
28 | public void adjustmentValueChanged(AdjustmentEvent e) {
29 |
30 | }
31 |
32 | @Override
33 | public void actionPerformed(ActionEvent e) {
34 |
35 | }
36 |
37 | }
38 |
39 | class Bag {
40 |
41 | }
42 |
43 | class BagWindowSuper {
44 |
45 | public BagWindowSuper(String title) {
46 | // do nothing
47 | }
48 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/BeanWithUnderscores.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class BeanWithUnderscores {
4 |
5 | private int _age;
6 |
7 | private String _firstName;
8 |
9 | private String _lastName;
10 |
11 | private String _userName;
12 |
13 | public int getAge() {
14 | return _age;
15 | }
16 |
17 | public void setAge(int age) {
18 | this._age = age;
19 | }
20 |
21 | public String getFirstName() {
22 | return _firstName;
23 | }
24 |
25 | public void setFirstName(String firstName) {
26 | this._firstName = firstName;
27 | }
28 |
29 | public String getLastName() {
30 | return _lastName;
31 | }
32 |
33 | public void setLastName(String lastName) {
34 | this._lastName = lastName;
35 | }
36 |
37 | public String getUserName() {
38 | return _userName;
39 | }
40 |
41 | public void setUserName(String userName) {
42 | this._userName = userName;
43 | }
44 |
45 | public String toString() {
46 | return _firstName + " " + this._lastName;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/SwitchCase.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class SwitchCase {
4 |
5 | public void run() {
6 | int i = hashCode();
7 | switch (i) {
8 | case 0: System.out.println(0);
9 | case 1: System.out.println(1);
10 | default: System.out.println(i);
11 | }
12 | }
13 |
14 | public void run2() {
15 | int i = hashCode();
16 | switch (i) {
17 | case 0:
18 | case 1: System.out.println(1);
19 | default: System.out.println(i);
20 | }
21 | }
22 |
23 | public void run3() {
24 | int i = hashCode();
25 | switch (i) {
26 | case 0: break;
27 | case 1: System.out.println(1); break;
28 | default: System.out.println(i);
29 | }
30 | }
31 |
32 | public void run4() {
33 | String str = null;
34 | int i = hashCode();
35 | switch (i) {
36 | case 0: str = "0"; break;
37 | case 1: str = "1"; break;
38 | default: str = String.valueOf(i);
39 | }
40 | System.err.println(str);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/ArrayUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011, Mysema Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.examples;
15 |
16 | /**
17 | * @author tiwe
18 | *
19 | */
20 | public final class ArrayUtils {
21 |
22 | public static Object[] combine(int size, Object[]... arrays) {
23 | int offset = 0;
24 | Object[] target = new Object[size];
25 | for (Object[] arr : arrays) {
26 | System.arraycopy(arr, 0, target, offset, arr.length);
27 | offset += arr.length;
28 | }
29 | return target;
30 | }
31 |
32 | private ArrayUtils() {}
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Bean2.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Bean2 {
4 |
5 | public static void main(String[] args) {
6 | Bean2 bean = new Bean2();
7 | bean.setFirstName("John");
8 | System.out.println(bean.getFirstName());
9 | }
10 |
11 | private int age;
12 |
13 | private String firstName;
14 |
15 | private String lastName;
16 |
17 | private String userName;
18 |
19 | public int getAge() {
20 | return age;
21 | }
22 |
23 | public void setAge(int age) {
24 | this.age = age;
25 | }
26 |
27 | public String getFirstName() {
28 | return firstName;
29 | }
30 |
31 | public void setFirstName(String firstName) {
32 | this.firstName = firstName;
33 | }
34 |
35 | public String getLastName() {
36 | return lastName;
37 | }
38 |
39 | public void setLastName(String lastName) {
40 | this.lastName = lastName;
41 | }
42 |
43 | public String getUserName() {
44 | return userName;
45 | }
46 |
47 | public void setUserName(String userName) {
48 | this.userName = userName;
49 | }
50 |
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scalagen/Cli.scala:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011, James McMahon
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.scalagen
15 |
16 | import java.io.File
17 |
18 | /**
19 | * Simple harness to facilitate running scalagen from the command line
20 | */
21 | object Cli {
22 | val usage = "USAGE: scalagen "
23 |
24 | def main(args: Array[String]) {
25 | if (args.length != 2) {
26 | println(usage)
27 | return
28 | }
29 |
30 | val in = new File(args(0))
31 | if (in.exists) {
32 | val out = new File(args(1))
33 | Converter.instance.convert(in, out)
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/QueryDelegate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011, Mysema Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.examples;
15 |
16 | import static java.lang.annotation.ElementType.METHOD;
17 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * Declaration of a static delegate method
25 | *
26 | * @author tiwe
27 | *
28 | */
29 | @Documented
30 | @Target({METHOD})
31 | @Retention(RUNTIME)
32 | public @interface QueryDelegate {
33 |
34 | /**
35 | * @return
36 | */
37 | Class> value();
38 |
39 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/Models.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.util;
18 |
19 | import com.sun.codemodel.JAnnotationArrayMember;
20 | import com.sun.codemodel.JAnnotationUse;
21 | import com.sun.codemodel.JMethod;
22 |
23 | public class Models {
24 |
25 | public static void suppressWarnings(JMethod method, String... values) {
26 | JAnnotationUse annotation = method.annotate(SuppressWarnings.class);
27 | JAnnotationArrayMember member = annotation.paramArray("value");
28 | for( String value : values ) {
29 | member.param(value);
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/example/android/lib/src/main/java/jsonschema2pojo/joelittlejohn/github/com/androidlibexample/AndroidLibExample.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package jsonschema2pojo.joelittlejohn.github.com.androidlibexample;
18 |
19 | import com.oosocial.clarityn.rest.clarityn.model.Entry_schema;
20 | import com.oosocial.clarityn.rest.clarityn.model.Storage;
21 |
22 | public final class AndroidLibExample {
23 |
24 | public static void example() {
25 | Entry_schema schema = new Entry_schema();
26 | schema.setReadonly(false);
27 | schema.setFstype(Entry_schema.Fstype.EXT_4);
28 | schema.setStorage(new Storage());
29 | }
30 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scalagen/Rename.scala:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011, Mysema Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.scalagen
15 |
16 | import japa.parser.ast.body.ModifierSet
17 | import java.util.ArrayList
18 | import UnitTransformer._
19 |
20 | class RenameTransformer(replacements: Map[String, String]) extends UnitTransformerBase {
21 |
22 | def transform(cu: CompilationUnit): CompilationUnit = {
23 | cu.accept(this, cu).asInstanceOf[CompilationUnit]
24 | }
25 |
26 | override def visit(n: Name, arg: CompilationUnit): Node = {
27 | if (replacements.contains(n.getName)) {
28 | new Name(replacements(n.getName))
29 | } else {
30 | n
31 | }
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Bean.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class Bean {
4 |
5 | public static void main(String[] args) {
6 | Bean bean = new Bean();
7 | bean.setFirstName("John");
8 | System.out.println(bean.getFirstName());
9 | }
10 |
11 | private int age;
12 |
13 | private String firstName, lastName, userName;
14 |
15 | private boolean male;
16 |
17 | public int getAge() {
18 | return age;
19 | }
20 |
21 | public void setAge(int age) {
22 | this.age = age;
23 | }
24 |
25 | public String getFirstName() {
26 | return firstName;
27 | }
28 |
29 | public void setFirstName(String firstName) {
30 | this.firstName = firstName;
31 | }
32 |
33 | public String getLastName() {
34 | return lastName;
35 | }
36 |
37 | public void setLastName(String lastName) {
38 | this.lastName = lastName;
39 | }
40 |
41 | public String getUserName() {
42 | return userName;
43 | }
44 |
45 | public void setUserName(String userName) {
46 | this.userName = userName;
47 | }
48 |
49 | public boolean isMale() {
50 | return male;
51 | }
52 |
53 | public void setMale(boolean male) {
54 | this.male = male;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/Resource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010 Mysema Ltd.
3 | * All rights reserved.
4 | *
5 | */
6 | package com.mysema.examples;
7 |
8 |
9 |
10 | /**
11 | * Resource provides
12 | *
13 | * @author tiwe
14 | * @version $Id$
15 | */
16 | public class Resource {
17 |
18 | private final boolean forward;
19 |
20 | private final boolean l10n;
21 |
22 | private String path;
23 |
24 | public Resource(String path, boolean forward, boolean l10n) {
25 | this.path = path;
26 | this.forward = forward;
27 | this.l10n = l10n;
28 | }
29 |
30 | public boolean equals(Object o) {
31 | return o instanceof Resource && ((Resource) o).path.equals(path);
32 | }
33 |
34 | public int hashCode(){
35 | return path.hashCode();
36 | }
37 |
38 | public String getPath() {
39 | return path;
40 | }
41 |
42 | public void addPathPrefix(String basePath) {
43 | this.path = basePath + path;
44 | }
45 |
46 | public boolean isForward() {
47 | return forward;
48 | }
49 |
50 | public boolean isL10n() {
51 | return l10n;
52 | }
53 |
54 | @Override
55 | public String toString(){
56 | return path;
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/schema/array.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "list of products",
3 | "type": "object",
4 | "javaType": "Product",
5 | "properties":
6 | {
7 | "id":
8 | {
9 | "title": "id",
10 | "type": "string",
11 | "additionalProperties": false
12 | },
13 |
14 | "titleSortName":
15 | {
16 | "type": "string"
17 | },
18 |
19 | "productType":
20 | {
21 | "title": "Type of products",
22 | "type": "array",
23 | "items":
24 | {
25 | "$ref": "#/definitions/product-type"
26 | }
27 | }
28 | },
29 |
30 | "definitions":
31 | {
32 | "product-type":
33 | {
34 | "title": "product type",
35 | "type": "object",
36 | "javaType": "ProductTypes",
37 | "properties":
38 | {
39 | "id":
40 | {
41 | "title": "Id",
42 | "type": "string",
43 | "additionalProperties": false
44 | },
45 |
46 | "type":
47 | {
48 | "title": "Type",
49 | "type": "string"
50 | }
51 | }
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/java/org/jsonschema2pojo/util/MakeUniqueClassNameTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2014 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.util;
18 |
19 | import static org.hamcrest.Matchers.equalTo;
20 | import static org.junit.Assert.assertThat;
21 |
22 | import org.junit.Test;
23 |
24 | public class MakeUniqueClassNameTest {
25 |
26 | @Test
27 | public void testClassNameStrategy() {
28 | assertThat(MakeUniqueClassName.makeUnique("NodeMode"), equalTo("NodeMode__1"));
29 | assertThat(MakeUniqueClassName.makeUnique("NodeMode__5"), equalTo("NodeMode__6"));
30 | assertThat(MakeUniqueClassName.makeUnique("NodeMode__10"), equalTo("NodeMode__11"));
31 | assertThat(MakeUniqueClassName.makeUnique("NodeMode__100"), equalTo("NodeMode__101"));
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/test/resources/example-json/user.json:
--------------------------------------------------------------------------------
1 | {
2 | "login": "raks81",
3 | "id": 5737258,
4 | "avatar_url": "https://avatars.githubusercontent.com/u/5737258?v=3",
5 | "gravatar_id": "",
6 | "url": "https://api.github.com/users/raks81",
7 | "html_url": "https://github.com/raks81",
8 | "followers_url": "https://api.github.com/users/raks81/followers",
9 | "following_url": "https://api.github.com/users/raks81/following{/other_user}",
10 | "gists_url": "https://api.github.com/users/raks81/gists{/gist_id}",
11 | "starred_url": "https://api.github.com/users/raks81/starred{/owner}{/repo}",
12 | "subscriptions_url": "https://api.github.com/users/raks81/subscriptions",
13 | "organizations_url": "https://api.github.com/users/raks81/orgs",
14 | "repos_url": "https://api.github.com/users/raks81/repos",
15 | "events_url": "https://api.github.com/users/raks81/events{/privacy}",
16 | "received_events_url": "https://api.github.com/users/raks81/received_events",
17 | "type": "User",
18 | "site_admin": false,
19 | "name": "Rakshith Rao",
20 | "company": "Cisco",
21 | "blog": null,
22 | "location": "Bangalore, India",
23 | "email": null,
24 | "hireable": true,
25 | "bio": null,
26 | "public_repos": 7,
27 | "public_gists": 0,
28 | "followers": 1,
29 | "following": 1,
30 | "created_at": "2013-10-21T12:30:46Z",
31 | "updated_at": "2015-12-21T15:33:24Z"
32 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/CommentsIT.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.integration;
18 |
19 | import org.jsonschema2pojo.integration.util.Jsonschema2PojoRule;
20 | import org.junit.Rule;
21 | import org.junit.Test;
22 |
23 | public class CommentsIT {
24 |
25 | @Rule
26 | public Jsonschema2PojoRule schemaRule = new Jsonschema2PojoRule();
27 |
28 | @Test
29 | public void jsonSchemaWithCommentsIsParsed() {
30 | schemaRule.generateAndCompile("/schema/comments/comments.json", "com.example");
31 | }
32 |
33 | @Test
34 | public void jsonWithCommentsIsParsed() {
35 | schemaRule.generateAndCompile("/json/comments.json", "com.example");
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/JavaNameRule.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.rules;
18 |
19 | import org.jsonschema2pojo.Schema;
20 |
21 | import com.fasterxml.jackson.databind.JsonNode;
22 | import com.sun.codemodel.JDocComment;
23 | import com.sun.codemodel.JDocCommentable;
24 |
25 | public class JavaNameRule implements Rule {
26 |
27 | @Override
28 | public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema currentSchema) {
29 | JDocComment javaDoc = generatableType.javadoc();
30 |
31 | javaDoc.append(String.format("%nCorresponds to the \"%s\" property.", nodeName));
32 |
33 | return javaDoc;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/resources/schema/format/customDateTimeFormat.json:
--------------------------------------------------------------------------------
1 | {
2 | "type" : "object",
3 | "properties" : {
4 | "defaultFormat" : {
5 | "type" : "string",
6 | "format" : "date-time"
7 | },
8 | "defaultFormatCustomTZ" : {
9 | "type" : "string",
10 | "format" : "date-time",
11 | "customTimezone" : "PST"
12 | },
13 | "customFormatDefaultTZ" : {
14 | "type" : "string",
15 | "format" : "date-time",
16 | "customDateTimePattern" : "yyyy-MM-dd'T'HH:mm:ss"
17 | },
18 | "customFormatCustomTZ" : {
19 | "type" : "string",
20 | "format" : "date-time",
21 | "customDateTimePattern" : "yyyy-MM-dd'T'HH:mm:ss",
22 | "customTimezone" : "PST"
23 | },
24 | "defaultFormatDate" : {
25 | "type" : "string",
26 | "format" : "date"
27 | },
28 | "defaultFormatTime" : {
29 | "type": "string",
30 | "format": "time"
31 | },
32 | "customFormatCustomDate" : {
33 | "type" : "string",
34 | "format" : "date",
35 | "customDatePattern" : "dd-MM-yyyy"
36 | },
37 | "customFormatCustomTime" : {
38 | "type" : "string",
39 | "format" : "time",
40 | "customTimePattern" : "H:mm a"
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/exception/GenerationException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.exception;
18 |
19 | /**
20 | * Represents an unexpected error during Java code generation.
21 | */
22 | public class GenerationException extends RuntimeException {
23 |
24 | private static final long serialVersionUID = -2105441912033842653L;
25 |
26 | public GenerationException(String message, Throwable cause) {
27 | super(message, cause);
28 | }
29 |
30 | public GenerationException(String message) {
31 | super(message);
32 | }
33 |
34 | public GenerationException(Throwable cause) {
35 | super(cause);
36 | }
37 |
38 | public GenerationException(String message, ClassNotFoundException cause) {
39 | super(message, cause);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scalagen/RemoveAsserts.scala:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011, Mysema Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.scalagen
15 |
16 | import java.util.ArrayList
17 | import UnitTransformer._
18 |
19 | object RemoveAsserts extends RemoveAsserts
20 |
21 | /**
22 | * RemoveAsserts unwraps assertion method call
23 | */
24 | class RemoveAsserts extends UnitTransformerBase {
25 |
26 | private val methods = Set("hasLength","hasText","notEmpty","notNull")
27 |
28 | def transform(cu: CompilationUnit): CompilationUnit = {
29 | cu.accept(this, cu).asInstanceOf[CompilationUnit]
30 | }
31 |
32 | // TODO : don't remove method calls when used as statements
33 |
34 | override def visit(n: MethodCall, arg: CompilationUnit) = n match {
35 | case MethodCall(str("Assert"), _, a :: rest) => a.accept(this, arg)
36 | case _ => super.visit(n, arg)
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-gradle-plugin/src/test/groovy/org/jsonschema2pojo/gradle/JsonSchemaPluginSpec.groovy:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2014 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.jsonschema2pojo.gradle
17 |
18 | import org.gradle.tooling.BuildLauncher
19 | import org.gradle.tooling.GradleConnector
20 | import org.gradle.tooling.ProjectConnection
21 | import org.junit.Test
22 |
23 | class JsonSchemaPluginSpec {
24 |
25 | @Test
26 | void java() {
27 | build("example/java");
28 | }
29 |
30 | void build(String projectDir) {
31 | GradleConnector connector = GradleConnector.newConnector()
32 | connector.forProjectDirectory(new File(projectDir))
33 | ProjectConnection connection = connector.connect()
34 | try {
35 | BuildLauncher launcher = connection.newBuild()
36 | launcher.forTasks("build")
37 | launcher.run()
38 | } finally {
39 | connection.close()
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/LanguageFeatures.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.util;
18 |
19 | import static java.util.Arrays.*;
20 |
21 | import java.util.Collection;
22 |
23 | import org.jsonschema2pojo.GenerationConfig;
24 |
25 | public class LanguageFeatures {
26 |
27 | private static final Collection LESS_THAN_8 = asList("1.1", "1.2", "1.3", "1.4", "1.5", "5", "1.6", "6", "1.7", "7");
28 | private static final Collection LESS_THAN_7 = asList("1.1", "1.2", "1.3", "1.4", "1.5", "5", "1.6", "6");
29 |
30 | public static boolean canUseJava7(GenerationConfig config) {
31 | return !LESS_THAN_7.contains(config.getTargetVersion());
32 | }
33 |
34 | public static boolean canUseJava8(GenerationConfig config) {
35 | return !LESS_THAN_8.contains(config.getTargetVersion());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/LocationAndKind.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010 Mysema Ltd.
3 | *
4 | * base on code from https://hickory.dev.java.net/
5 | *
6 | */
7 |
8 | package com.mysema.examples;
9 |
10 | import javax.tools.JavaFileManager.Location;
11 | import javax.tools.JavaFileObject.Kind;
12 |
13 | /**
14 | * LocationAndKind defines a pair of Location and Kind
15 | *
16 | * @author tiwe
17 | *
18 | */
19 | public class LocationAndKind {
20 |
21 | private final Kind kind;
22 |
23 | private final Location location;
24 |
25 | public LocationAndKind(Location location, Kind kind) {
26 | this.location = location;
27 | this.kind = kind;
28 | }
29 |
30 | @Override
31 | public boolean equals(Object obj) {
32 | if (obj == this){
33 | return true;
34 | }else if (obj instanceof LocationAndKind){
35 | LocationAndKind other = (LocationAndKind)obj;
36 | return location.equals(other.location) && kind.equals(other.kind);
37 | }else{
38 | return false;
39 | }
40 | }
41 |
42 | @Override
43 | public int hashCode() {
44 | return kind.hashCode() * 31 + location.hashCode();
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return kind.toString() + "@" + location.toString();
50 | }
51 |
52 |
53 |
54 |
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/URLProtocol.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo;
18 |
19 | public enum URLProtocol {
20 | FILE("file"),
21 | RESOURCE("resource"),
22 | JAVA("java"),
23 | CLASSPATH("classpath"),
24 | HTTP("http"),
25 | HTTPS("https"),
26 | NO_PROTOCOL("");
27 |
28 | private String protocol;
29 |
30 | URLProtocol(final String protocol) {
31 | this.protocol = protocol;
32 | }
33 |
34 | public String getProtocol() {
35 | return protocol;
36 | }
37 |
38 | public static URLProtocol fromString(final String input) {
39 | for (URLProtocol protocol : URLProtocol.values()) {
40 | if (protocol.getProtocol().equalsIgnoreCase(input)) {
41 | return protocol;
42 | }
43 | }
44 | // default to file
45 | return NO_PROTOCOL;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/main/scala/com/mysema/scalagen/Synchronized.scala:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011, Mysema Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 | package com.mysema.scalagen
15 |
16 | import java.util.ArrayList
17 | import japa.parser.ast.CompilationUnit
18 | import UnitTransformer._
19 | import defs._
20 | import japa.parser.ast.body.ModifierSet
21 |
22 | object Synchronized extends Synchronized
23 |
24 | /**
25 | *
26 | */
27 | class Synchronized extends ModifierVisitor[CompilationUnit] with UnitTransformer {
28 |
29 | def transform(cu: CompilationUnit): CompilationUnit = {
30 | cu.accept(this, cu).asInstanceOf[CompilationUnit]
31 | }
32 |
33 | override def visit(nn: Method, arg: CompilationUnit) = {
34 | val n = super.visit(nn, arg).asInstanceOf[Method]
35 | if (n.getModifiers.hasModifier(ModifierSet.SYNCHRONIZED)) {
36 | n.removeModifier(ModifierSet.SYNCHRONIZED)
37 | n.setBody(new SynchronizedStmt(null, n.getBody()))
38 | }
39 | n
40 | }
41 |
42 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-scalagen/src/test/scala/com/mysema/examples/LongLinesIncludingAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName.java:
--------------------------------------------------------------------------------
1 | package com.mysema.examples;
2 |
3 | public class LongLinesIncludingAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName extends LongClassToExtendAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {
4 | LongLinesIncludingAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName x = new LongLinesIncludingAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName(444, 2, 3, 4, 5, 6, 7, 8, 9, 10);
5 |
6 | public LongLinesIncludingAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName(int... nums) {
7 | }
8 |
9 | public LongLinesIncludingAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName(int a, int b, int c, int d, int e) {
10 | this(a, b, c, d, e, 1, 2, 3, 4, 5);
11 | }
12 |
13 | public void a(int... nums) {
14 | if ("very long condition ........................".length() > 0 || "other long condition".length() > 0) {
15 | a(555, 2, 3, 4, 5, 6, 7, 8, 9);
16 | }
17 | int[] aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = nums;
18 | for (int n : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {
19 | if ("long condition goes here ........................".length() > 0) {
20 | System.out.println(n);
21 | }
22 | }
23 | }
24 | }
25 |
26 | class LongClassToExtendAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {
27 | public LongClassToExtendAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
28 | }
29 |
30 | public LongClassToExtendAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(int... nums) {
31 | }
32 | }
--------------------------------------------------------------------------------
/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/ScalaIT.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.integration.config;
18 |
19 | import org.jsonschema2pojo.integration.util.Jsonschema2PojoRule;
20 | import org.junit.Rule;
21 | import org.junit.Test;
22 | import static org.junit.Assert.*;
23 | import static org.jsonschema2pojo.integration.util.CodeGenerationHelper.*;
24 |
25 | import java.io.File;
26 |
27 | public class ScalaIT {
28 |
29 | @Rule public Jsonschema2PojoRule schemaRule = new Jsonschema2PojoRule();
30 |
31 | @Test
32 | public void scalaFilesAreGeneratedAndJavaFilesAreNot() {
33 | File outputDirectory = schemaRule.generate("/schema/properties/primitiveProperties.json", "com.example",
34 | config("targetLanguage", "scala"));
35 |
36 | assertTrue(new File(outputDirectory, "com/example/PrimitiveProperties.scala").exists());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ValidRule.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright © 2010-2017 Nokia
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jsonschema2pojo.rules;
18 |
19 | import javax.validation.Valid;
20 |
21 | import com.fasterxml.jackson.databind.JsonNode;
22 | import org.jsonschema2pojo.Schema;
23 | import com.sun.codemodel.JFieldVar;
24 | import scala.annotation.meta.field;
25 |
26 | public class ValidRule implements Rule {
27 |
28 | private final RuleFactory ruleFactory;
29 |
30 | public ValidRule(RuleFactory ruleFactory) {
31 | this.ruleFactory = ruleFactory;
32 | }
33 |
34 | @Override
35 | public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) {
36 |
37 | if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations()) {
38 | field.annotate(Valid.class);
39 | }
40 |
41 | return field;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## 1. Use a feature branch
2 |
3 | Feature branches make pull requests easier as GitHub will keep your pull request up-to-date when the feature branch changes. If you need to rebase to fix some things after creating your pull request, or if you end up having multiple pull requests open at the same time, **having a pull request associated with a branch instead of `master` will make your job easier**.
4 |
5 | ## 2. Run the test suite
6 |
7 | *jsonschema2pojo* includes both unit and integration tests. The unit test coverage is not high, instead we rely on an exhaustive set of integration tests that cover all the code generation features using example schema documents.
8 |
9 | To compile, unit test, package, and run the integration test suite (the typical full build), use:
10 |
11 | `mvn clean verify`
12 |
13 | ## 3. Add integration tests
14 |
15 | When contributing, you may often find unit tests (and TDD) helpful and you're free to add unit tests. **If you're adding/amending code generation features then integration tests (*end-to-end* tests that use an example schema to generate and compile Java code) are essential**. We can't merge pull requests unless they have integration tests, since without tests your feature could be lost in a future release.
16 |
17 | ## 4. Rebase and keep a clean log
18 |
19 | Rebase against master often, if your pull request is stale it can't be merged. Rebase your commits into logical chunks, without errors (multiple commits are okay, but **squash minor commits that fix errors in earlier commits**). Force-push to your feature branch after you have rebased.
20 |
--------------------------------------------------------------------------------