Commit d3adfe56 authored by Noel's avatar Noel
Browse files

Añade etiqueta para poner no null una clase

parent 6a52df22
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
package com.kjetland.jackson.jsonSchema.annotations;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({ METHOD, FIELD, PARAMETER, TYPE })
@Retention(RUNTIME)
public @interface JsonSchemaNotNull {
}
+7 −3
Original line number Diff line number Diff line
@@ -704,7 +704,7 @@ class JsonSchemaGenerator
              val objectBuilder: ObjectNode => Option[JsonObjectFormatVisitor] = {
                thisObjectNode: ObjectNode =>


                  //thisObjectNode.put("type", "object")
                  //thisObjectNode.put("additionalProperties", false)

                  // If class is annotated with JsonSchemaFormat, we should add it
@@ -714,6 +714,12 @@ class JsonSchemaGenerator
                      setFormat(thisObjectNode, format)
                  }

                  if (ac.getAnnotation(classOf[JsonSchemaNotNull]) != null) {
                    thisObjectNode.put("type", "object")
                  } else {
                    setType(thisObjectNode, null, "object")
                  }

                  // If class is annotated with JsonSchemaDescription, we should add it
                  Option(ac.getAnnotations.get(classOf[JsonSchemaDescription])).map(_.value())
                    .orElse(Option(ac.getAnnotations.get(classOf[JsonPropertyDescription])).map(_.value))
@@ -769,8 +775,6 @@ class JsonSchemaGenerator

                      if (propertyIsNotIgnored(prop)) {

                        setType(thisObjectNode, prop, "object");

                        l(s"JsonObjectFormatVisitor - ${propertyName}: ${propertyType}")
                        if (propertiesNode.get(propertyName) != null) {
                          if (!config.disableWarnings) {