コード例 #1
0
        /// <summary>
        /// Writes this schema to a <see cref="JsonWriter"/> using the specified <see cref="JSchemaResolver"/>.
        /// </summary>
        /// <param name="writer">A <see cref="JsonWriter"/> into which this method will write.</param>
        /// <param name="settings">The settings used to write the schema.</param>
        public void WriteTo(JsonWriter writer, JSchemaWriterSettings settings)
        {
            ValidationUtils.ArgumentNotNull(writer, nameof(writer));
            ValidationUtils.ArgumentNotNull(settings, nameof(settings));

            WriteToInternal(writer, settings);
        }
コード例 #2
0
        /// <summary>
        /// Returns the JSON for this schema using the specified <see cref="SchemaVersion"/>.
        /// </summary>
        /// <param name="version">The <see cref="SchemaVersion"/> used to create JSON for this schema.</param>
        /// <returns>The JSON for this schema.</returns>
        public string ToString(SchemaVersion version)
        {
            JSchemaWriterSettings settings = version != Schema.SchemaVersion.Unset
                ? new JSchemaWriterSettings {
                Version = version
            }
                : null;

            return(ToStringInternal(settings));
        }
コード例 #3
0
        private string ToStringInternal(JSchemaWriterSettings settings)
        {
            StringWriter   writer     = new StringWriter(CultureInfo.InvariantCulture);
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);

            jsonWriter.Formatting = Formatting.Indented;

            WriteToInternal(jsonWriter, settings);

            return(writer.ToString());
        }
コード例 #4
0
        private void WriteToInternal(JsonWriter writer, JSchemaWriterSettings settings)
        {
            JSchemaWriter schemaWriter = new JSchemaWriter(writer, settings);

            schemaWriter.WriteSchema(this);
        }
コード例 #5
0
        private void WriteToInternal(JsonWriter writer, JSchemaWriterSettings settings)
        {
            JSchemaWriter schemaWriter = new JSchemaWriter(writer, settings);

            schemaWriter.WriteSchema(this);
        }
コード例 #6
0
        /// <summary>
        /// Writes this schema to a <see cref="JsonWriter"/> using the specified <see cref="JSchemaResolver"/>.
        /// </summary>
        /// <param name="writer">A <see cref="JsonWriter"/> into which this method will write.</param>
        /// <param name="settings">The settings used to write the schema.</param>
        public void WriteTo(JsonWriter writer, JSchemaWriterSettings settings)
        {
            ValidationUtils.ArgumentNotNull(writer, "writer");
            ValidationUtils.ArgumentNotNull(settings, "settings");

            WriteToInternal(writer, settings);
        }