Basic Container Item Annotation Support #61
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes should cover the majority of use-cases as per #60 for container items.
This is explicitly not covering other generics such as
Optional<@NotBlank String>
.Also for collections, this "basic" support is only going "one level deep", i.e.
List<@Size(min = 3) String>
will now pick-up the "minLength" for theString
list itemsList<List<@Size(min = 3) String>>
will not recognize the "minLength" attributesSince the
classmate
library used for type resolution currently does not include theAnnotatedType
(introduced in Java 8), some additional changes will be required to make this work for more than the first level of container items.At that time, a more generic approach can be taken to support other parameterized types besides collections.
jsonschema-generator
Added
FieldScope
/MethodScope
for accessing (first level) container item annotations:getContainerItemAnnotation()
andgetContainerItemAnnotationConsideringFieldAndGetter()
Changed
MethodScope.getAnnotation()
now also considers annotations directly on return type (when no matching annotation was found on the method itself)jsonschema-module-javax-validation
Changed
List<@Size(min = 3) String>
)