import java.io.IOException;
import java.io.OutputStreamWriter;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
-import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev170126.Errors;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
* JSON stream-writer with disabled leaf-type validation for specified QName.
*/
final class JsonStreamWriterWithDisabledValidation extends StreamWriterWithDisabledValidation {
-
private static final int DEFAULT_INDENT_SPACES_NUM = 2;
+ private static final XMLNamespace IETF_RESTCONF_URI = Errors.QNAME.getModule().getNamespace();
private final JsonWriter jsonWriter;
private final NormalizedNodeStreamWriter jsonNodeStreamWriter;
/**
* Creation of the custom JSON stream-writer.
*
- * @param excludedQName QName of the element that is excluded from type-check.
- * @param outputWriter Output stream that is used for creation of JSON writers.
- * @param schemaPath Schema-path of the {@link NormalizedNode} to be written.
- * @param initialNs Initial namespace derived from schema node of the data that are serialized.
* @param schemaContextHandler Handler that holds actual schema context.
+ * @param outputWriter Output stream that is used for creation of JSON writers.
*/
- JsonStreamWriterWithDisabledValidation(final QName excludedQName, final OutputStreamWriter outputWriter,
- final XMLNamespace initialNs, final SchemaContextHandler schemaContextHandler) {
- super(excludedQName);
+ JsonStreamWriterWithDisabledValidation(final SchemaContextHandler schemaContextHandler,
+ final OutputStreamWriter outputWriter) {
jsonWriter = JsonWriterFactory.createJsonWriter(outputWriter, DEFAULT_INDENT_SPACES_NUM);
-
final var inference = errorsContainerInference(schemaContextHandler);
jsonNodeStreamWriter = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
JSONCodecFactorySupplier.RFC7951.getShared(inference.getEffectiveModelContext()),
- inference, initialNs, jsonWriter);
+ inference, IETF_RESTCONF_URI, jsonWriter);
}
@Override