Merges the {@code message} with the byte array using the given {@code schema}.
516199
public static <T> void mergeFrom(byte[] data, int offset, int len, T message,
            Schema<T> schema, XMLInputFactory inFactory)
    {
        final ByteArrayInputStream in = new ByteArrayInputStream(data, offset, len);
        try
        {
            mergeFrom(in, message, schema, inFactory);
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
    }
663700
public static <T> List<T> parseListFrom(MessageUnpacker unpacker, Schema<T> schema, boolean numeric)
            throws IOException
    {

        MsgpackParser parser = new MsgpackParser(unpacker, numeric);
        MsgpackInput input = new MsgpackInput(parser);

        List<T> list = new ArrayList<T>();

        while (parser.hasNext())
        {

            T message = schema.newMessage();
            schema.mergeFrom(input, message);

            list.add(message);

            parser.reset();

        }

        return list;
    }
571589
def _prepend_schema_name(self, message):
        
        if self._name:
            message = "{0!r} {1!s}".format(self._name, message)
        return message
14200
public static byte schemaToColumnType(Schema s) {
    Schema.Type typ =  s.getType();
    switch (typ) {
      case BOOLEAN:
      case INT:
      case LONG:
      case FLOAT:
      case DOUBLE:
        return Vec.T_NUM;
      case ENUM:
        return Vec.T_CAT;
      case STRING:
        return Vec.T_STR;
      case NULL:
        return Vec.T_BAD;
      case BYTES:
        return Vec.T_STR;
      case UNION: // Flattenize the union
        List<Schema> unionSchemas = s.getTypes();
        if (unionSchemas.size() == 1) {
          return schemaToColumnType(unionSchemas.get(0));
        } else if (unionSchemas.size() == 2) {
          Schema s1 = unionSchemas.get(0);
          Schema s2 = unionSchemas.get(1);
          if (s1.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s2);
          else if (s2.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s1);
        }
      default:
        throw new IllegalArgumentException("Unsupported Avro schema type: " + s);
    }
  }
1106167
public static void merge(final Readable input,
                           final Message.Builder builder)
                           throws IOException {
    merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
  }
1009860
public static StringBuilder concat(final String... message) {
        final StringBuilder builder = new StringBuilder();
        for (final String mess : message) {
            builder.append(mess);
            builder.append(" ");
        }
        return builder;
    }
739076
public static <T> void writeListTo(LinkedBuffer buffer,
            List<T> messages, Schema<T> schema, boolean numeric)
    {
        if (buffer.start != buffer.offset)
        {
            throw new IllegalArgumentException("Buffer previously used and had not been reset.");
        }

        if (messages.isEmpty())
        {
            return;
        }

        MsgpackXOutput output = new MsgpackXOutput(buffer, numeric, schema);

        try
        {

            for (T m : messages)
            {

                LinkedBuffer objectStarter = output.writeStartObject();
                schema.writeTo(output, m);

                if (output.isLastRepeated())
                {
                    output.writeEndArray();
                }

                output.writeEndObject(objectStarter);

            }

        }
        catch (IOException e)
        {
            throw new RuntimeException("Serializing to a byte array threw an IOException " +
                    "(should never happen).", e);
        }
    }
974351
private void performSchemaValidation(Message receivedMessage, JsonMessageValidationContext validationContext) {
        log.debug("Starting Json schema validation ...");

        ProcessingReport report = jsonSchemaValidation.validate(receivedMessage,
                                                                schemaRepositories,
                                                                validationContext,
                                                                applicationContext);
        if (!report.isSuccess()) {
            log.error("Failed to validate Json schema for message:\n" + receivedMessage.getPayload(String.class));

            throw new ValidationException(constructErrorMessage(report));
        }

        log.info("Json schema validation successful: All values OK");
    }
1245487
public void addSchema(String version, TTypes types, MessageInfo recMessageInfo)
    {
        String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString());
        
        Import importel = schemaFactory.createImport();
        org.w3._2001.xmlschema.Schema schema = (org.w3._2001.xmlschema.Schema)types.getAny().get(0);    // LAME
        schema.getIncludeOrImportOrRedefine().add(importel);
        String code = recMessageInfo.getField(MessageInfo.CODE).toString();
        if (code == null)
            code = name;
        String namespace = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.NAMESPACE);
        String element = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.ELEMENT);
        String schemaLocation = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.SCHEMA_LOCATION);
        
        if (namespace == null)
            namespace = this.getMessageControl().getNamespaceFromVersion(version);
        if (element == null)
            if (code != null)
                element = code;
        if (schemaLocation == null)
            if (code != null)
                schemaLocation = code + ".xsd";
        schemaLocation = this.getMessageControl().getSchemaLocation(version, schemaLocation);
        if (namespace != null)
            importel.setNamespace(namespace);
        importel.setSchemaLocation(schemaLocation);
    }
804350
public static <T> void writeTo(XMLStreamWriter writer, T message, Schema<T> schema)
            throws IOException, XMLStreamException, XmlOutputException
    {
        writer.writeStartElement(schema.messageName());

        schema.writeTo(new XmlOutput(writer, schema), message);

        writer.writeEndElement();
    }
495226
public DataWriterBuilder<S, D> withSchema(S schema) {
    this.schema = schema;
    log.debug("withSchema : {}", this.schema);
    return this;
  }
170687
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema,
            XMLOutputFactory outFactory) throws IOException
    {
        XMLStreamWriter writer = null;
        try
        {
            writer = outFactory.createXMLStreamWriter(out, XML_ENCODING);

            writer.writeStartDocument(XML_ENCODING, XML_VERSION);
            writeTo(writer, message, schema);
            writer.writeEndDocument();

            writer.flush();
        }
        catch (XMLStreamException e)
        {
            throw new XmlOutputException(e);
        }
        finally
        {
            if (writer != null)
            {
                try
                {
                    writer.close();
                }
                catch (XMLStreamException e)
                {
                    // ignore
                }
            }
        }
    }
794307
public void setSchema(String schema)
   {
      if (schema.charAt(schema.length() - 1) != '.')
      {
         schema = schema + '.';
      }
      m_schema = schema;
   }
1239015
function merge (schema, doc, self) {
  var keys = Object.keys(doc);

  for (var i = 0; i < keys.length; ++i) {
    var key = keys[i];
    var type;

    // if nothing in schema yet, just assign
    if ('undefined' == typeof schema[key]) {
      var type = self.getType(doc, key);
      if (undefined !== type) {
        schema[key] = type;
      }
      continue;
    }

    // exists in schema and incoming is an object?
    if (isObject(doc[key])) {
      if (isObject(schema[key])) {
        merge(schema[key], doc[key], self);

      } else {
        type = self.getType(doc, key);
        if (undefined !== type) {
          if ('null' == schema[key]) {
            schema[key] = type;
          } else if (type != schema[key]) {
            schema[key] = 'Mixed';
          }
        }
      }
    } else {
      // exists in schema and incoming is not an object.
      var type = self.getType(doc, key);
      if (undefined === type) {
        continue;
      }

      if ('null' == schema[key]) {
        schema[key] = type;

      } else if ('null' == type) {
        // ignore

      } else if (Array.isArray(schema[key]) && Array.isArray(type)) {

        if (0 === schema[key].length) {
          schema[key] = type;

        } else if (schema[key][0] instanceof Schema && isObject(type[0])) {
          // merge schemas
          schema[key][0].combine(type[0]);

        } else if (!equalType(schema[key], type)) {
          schema[key] = ['Mixed'];
        }

      } else if (!equalType(schema[key], type)) {
        schema[key] = 'Mixed';
      }
    }
  }
}
1368010
public static <T> byte[] toByteArray(T message, Schema<T> schema, LinkedBuffer buffer)
    {
        if (buffer.start != buffer.offset)
            throw new IllegalArgumentException("Buffer previously used and had not been reset.");

        final XmlXOutput output = new XmlXOutput(buffer, schema);

        final String name = schema.messageName();
        try
        {
            // header and start root element
            output.tail = output.sink.writeByte(XmlXOutput.END_TAG, output,
                    output.sink.writeStrAscii(name, output,
                            output.sink.writeByte(XmlXOutput.START_TAG, output,
                                    output.sink.writeByteArray(HEADER, output, output.tail))));

            schema.writeTo(output, message);

            // end root element
            output.tail = output.sink.writeByte(XmlXOutput.END_TAG, output,
                    output.sink.writeStrAscii(name, output,
                            output.sink.writeByteArray(XmlXOutput.START_SLASH_TAG, output, output.tail)));
        }
        catch (IOException e)
        {
            throw new RuntimeException("Serializing to a byte array threw an IOException " +
                    "(should never happen).", e);
        }

        return output.toByteArray();
    }
369479
public static <T> void mergeFrom(byte[] data, T message, Schema<T> schema,
            boolean numeric) throws IOException
    {
        mergeFrom(data, 0, data.length, message, schema, numeric);
    }
573326
public static int writeDelimitedTo(DataOutput out, Object message, Schema schema) 
    throws IOException
    {
        final LinkedBuffer buffer = new LinkedBuffer(LinkedBuffer.MIN_BUFFER_SIZE);
        final ProtobufOutput output = new ProtobufOutput(buffer);
        schema.writeTo(output, message);
        final int size = output.getSize();
        ProtobufOutput.writeRawVarInt32Bytes(out, size);
        
        LinkedBuffer.writeTo(out, buffer);
        //final int msgSize = LinkedBuffer.writeTo(out, buffer);
        //assert size == msgSize;
        
        return size;
    }