class JsonSchema extends AbstractJsonSchema<JSONSchemaProps, JSONSchemaPropsBuilder> {

  private static final JsonSchema instance = new JsonSchema();

  private static final JSONSchemaProps JSON_SCHEMA_INT_OR_STRING = new JSONSchemaPropsBuilder()
      .withXKubernetesIntOrString(true)
      .withAnyOf(
          new JSONSchemaPropsBuilder().withType("integer").build(),
          new JSONSchemaPropsBuilder().withType("string").build())
      .build();

  /**
   * Creates the JSON schema for the particular {@link TypeDef}.
   *
   * @param definition The definition.
   * @param ignore an optional list of property names to ignore
   * @return The schema.
   */
  public static JSONSchemaProps from(TypeDef definition, String... ignore) {
    return instance.internalFrom(definition, ignore);
  }

  @Override
  public JSONSchemaPropsBuilder newBuilder() {
    return newBuilder("object");
  }

  @Override
  public JSONSchemaPropsBuilder newBuilder(String type) {
    final JSONSchemaPropsBuilder builder = new JSONSchemaPropsBuilder();
    builder.withType(type);
    return builder;
  }

  @Override
  public void addProperty(Property property, JSONSchemaPropsBuilder builder,
      JSONSchemaProps schema, SchemaPropsOptions options) {
    if (schema != null) {
      options.getDefault().ifPresent(s -> {
        try {
          schema.setDefault(YAML_MAPPER.readTree(s));
        } catch (JsonProcessingException e) {
          throw new IllegalArgumentException("Cannot parse default value: '" + s + "' as valid YAML.");
        }
      });
      options.getMin().ifPresent(schema::setMinimum);
      options.getMax().ifPresent(schema::setMaximum);
      options.getPattern().ifPresent(schema::setPattern);

      List<ValidationRule> validationRulesFromProperty = options.getValidationRules().stream()
          .map(this::mapValidationRule)
          .collect(Collectors.toList());

      List<ValidationRule> resultingValidationRules = new ArrayList<>(schema.getXKubernetesValidations());
      resultingValidationRules.addAll(validationRulesFromProperty);

      if (!resultingValidationRules.isEmpty()) {
        schema.setXKubernetesValidations(resultingValidationRules);
      }

      if (options.isNullable()) {
        schema.setNullable(true);
      }

      if (options.isPreserveUnknownFields()) {
        schema.setXKubernetesPreserveUnknownFields(true);
      }

      builder.addToProperties(property.getName(), schema);
    }
  }

  @Override
  public JSONSchemaProps build(JSONSchemaPropsBuilder builder, List<String> required,
      List<KubernetesValidationRule> validationRules, boolean preserveUnknownFields) {
    builder = builder.withRequired(required);
    if (preserveUnknownFields) {
      builder.withXKubernetesPreserveUnknownFields(preserveUnknownFields);
    }
    builder.addAllToXKubernetesValidations(mapValidationRules(validationRules));
    return builder.build();
  }

  @Override
  protected JSONSchemaProps arrayLikeProperty(JSONSchemaProps schema) {
    return new JSONSchemaPropsBuilder()
        .withType("array")
        .withNewItems()
        .withSchema(schema)
        .and()
        .build();
  }

  @Override
  protected JSONSchemaProps mapLikeProperty(JSONSchemaProps schema) {
    return new JSONSchemaPropsBuilder()
        .withType("object")
        .withNewAdditionalProperties()
        .withSchema(schema)
        .endAdditionalProperties()
        .build();
  }

  @Override
  protected JSONSchemaProps singleProperty(String typeName) {
    return new JSONSchemaPropsBuilder().withType(typeName).build();
  }

  @Override
  protected JSONSchemaProps mappedProperty(TypeRef ref) {
    return JSON_SCHEMA_INT_OR_STRING;
  }

  @Override
  protected JSONSchemaProps enumProperty(JsonNode... enumValues) {
    return new JSONSchemaPropsBuilder().withType("string").withEnum(enumValues).build();
  }

  @Override
  protected JSONSchemaProps addDescription(JSONSchemaProps schema, String description) {
    return new JSONSchemaPropsBuilder(schema)
        .withDescription(description)
        .build();
  }

  private List<ValidationRule> mapValidationRules(List<KubernetesValidationRule> validationRules) {
    return validationRules.stream()
        .map(this::mapValidationRule)
        .collect(Collectors.toList());
  }

  private ValidationRule mapValidationRule(KubernetesValidationRule validationRule) {<FILL_FUNCTION_BODY>}
}

    return new ValidationRuleBuilder()
        .withRule(validationRule.getRule())
        .withMessage(validationRule.getMessage())
        .withMessageExpression(validationRule.getMessageExpression())
        .withReason(validationRule.getReason())
        .withFieldPath(validationRule.getFieldPath())
        .withOptionalOldSelf(validationRule.getOptionalOldSelf())
        .build();
  
<methods>public non-sealed void <init>() ,public abstract void addProperty(Property, JSONSchemaPropsBuilder, JSONSchemaProps, io.fabric8.crd.generator.AbstractJsonSchema.SchemaPropsOptions) ,public abstract JSONSchemaProps build(JSONSchemaPropsBuilder, List<java.lang.String>, List<io.fabric8.crd.generator.AbstractJsonSchema.KubernetesValidationRule>, boolean) ,public static java.lang.String getSchemaTypeFor(TypeRef) ,public JSONSchemaProps internalFrom(java.lang.String, TypeRef) ,public abstract JSONSchemaPropsBuilder newBuilder() ,public abstract JSONSchemaPropsBuilder newBuilder(java.lang.String) <variables>public static final java.lang.String ANNOTATION_DEFAULT,public static final java.lang.String ANNOTATION_JSON_ANY_GETTER,public static final java.lang.String ANNOTATION_JSON_ANY_SETTER,public static final java.lang.String ANNOTATION_JSON_IGNORE,public static final java.lang.String ANNOTATION_JSON_PROPERTY,public static final java.lang.String ANNOTATION_JSON_PROPERTY_DESCRIPTION,public static final java.lang.String ANNOTATION_MAX,public static final java.lang.String ANNOTATION_MIN,public static final java.lang.String ANNOTATION_NULLABLE,public static final java.lang.String ANNOTATION_PATTERN,public static final java.lang.String ANNOTATION_PERSERVE_UNKNOWN_FIELDS,public static final java.lang.String ANNOTATION_REQUIRED,public static final java.lang.String ANNOTATION_SCHEMA_FROM,public static final java.lang.String ANNOTATION_SCHEMA_SWAP,public static final java.lang.String ANNOTATION_SCHEMA_SWAPS,public static final java.lang.String ANNOTATION_VALIDATION_RULE,public static final java.lang.String ANNOTATION_VALIDATION_RULES,public static final java.lang.String ANY_TYPE,private static final java.lang.String BOOLEAN_MARKER,private static final Map<TypeRef,java.lang.String> COMMON_MAPPINGS,protected static final TypeDef DATE,protected static final TypeRef DATE_REF,protected static final TypeDef DURATION,protected static final TypeRef DURATION_REF,private static final java.lang.String INTEGER_MARKER,protected static final TypeDef INT_OR_STRING,private static final java.lang.String INT_OR_STRING_MARKER,protected static final TypeRef INT_OR_STRING_REF,public static final java.lang.String JSON_NODE_TYPE,private static final Logger LOGGER,private static final java.lang.String NUMBER_MARKER,protected static final TypeDef OBJECT,protected static final TypeRef OBJECT_REF,protected static final TypeRef P_BOOLEAN_REF,protected static final TypeRef P_DOUBLE_REF,protected static final TypeRef P_FLOAT_REF,protected static final TypeRef P_INT_REF,protected static final TypeRef P_LONG_REF,protected static final TypeDef QUANTITY,protected static final TypeRef QUANTITY_REF,private static final java.lang.String STRING_MARKER,private static final java.lang.String VALUE