All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.rxjava3.json.schema.Schema Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR2
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava3.json.schema;

import io.vertx.rxjava3.RxHelper;
import io.vertx.rxjava3.ObservableHelper;
import io.vertx.rxjava3.FlowableHelper;
import io.vertx.rxjava3.impl.AsyncResultMaybe;
import io.vertx.rxjava3.impl.AsyncResultSingle;
import io.vertx.rxjava3.impl.AsyncResultCompletable;
import io.vertx.rxjava3.WriteStreamObserver;
import io.vertx.rxjava3.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

/**
 * Interface representing a Json Schema 
*

* A schema could have two states:
*

    *
  • Synchronous: The validators tree can provide a synchronous validation, so you can validate your json both using and
  • *
  • Asynchronous: One or more branches of the validator tree requires an asynchronous validation, so you must use to validate your json. If you use it will throw a {@link io.vertx.json.schema.NoSyncValidationException}
  • *
*

* To check the schema state you can use method . Note that invoking {@link io.vertx.rxjava3.json.schema.Schema#validateAsync} generally doesn't have any additional overhead than invoking {@link io.vertx.rxjava3.json.schema.Schema#validateSync}.
* The schema can mutate the state in time, e.g. if you have a schema that is asynchronous because of a $ref, * after the first validation the external schema is cached inside {@link io.vertx.rxjava3.json.schema.SchemaRouter} and this schema will switch to synchronous state
* *

* NOTE: This class has been automatically generated from the {@link io.vertx.json.schema.Schema original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.json.schema.Schema.class) public class Schema { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Schema that = (Schema) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new Schema((io.vertx.json.schema.Schema) obj), Schema::getDelegate ); private final io.vertx.json.schema.Schema delegate; public Schema(io.vertx.json.schema.Schema delegate) { this.delegate = delegate; } public Schema(Object delegate) { this.delegate = (io.vertx.json.schema.Schema)delegate; } public io.vertx.json.schema.Schema getDelegate() { return delegate; } /** * Validate the json performing an asynchronous validation.
*

* Note: If the schema is synchronous, this method will call internally * @param json input to validate * @return a failed future with {@link io.vertx.json.schema.ValidationException} if json doesn't match the schema, otherwise a succeeded future. */ @Deprecated() public io.vertx.core.Future validateAsync(java.lang.Object json) { io.vertx.core.Future ret = delegate.validateAsync(json).map(val -> val); return ret; } /** * Validate the json performing a synchronous validation. Throws a {@link io.vertx.json.schema.ValidationException} if json doesn't match the schema.
* @param json input to validate */ @Deprecated() public void validateSync(java.lang.Object json) { delegate.validateSync(json); } /** * @return scope of this schema */ @Deprecated() public io.vertx.rxjava3.core.json.pointer.JsonPointer getScope() { io.vertx.rxjava3.core.json.pointer.JsonPointer ret = io.vertx.rxjava3.core.json.pointer.JsonPointer.newInstance((io.vertx.core.json.pointer.JsonPointer)delegate.getScope()); return ret; } /** * @return Json representation of the schema */ @Deprecated() public java.lang.Object getJson() { java.lang.Object ret = (Object) delegate.getJson(); return ret; } /** * @return true if this validator can provide a synchronous validation. */ @Deprecated() public boolean isSync() { boolean ret = delegate.isSync(); return ret; } public static Schema newInstance(io.vertx.json.schema.Schema arg) { return arg != null ? new Schema(arg) : null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy