Exemplo n.º 1
0
        public static void PopulateFrom(this PartialSchema partialSchema, Schema schema)
        {
            if (schema == null)
            {
                return;
            }

            partialSchema.type   = schema.type;
            partialSchema.format = schema.format;

            if (schema.items != null)
            {
                // TODO: Handle jagged primitive array and error on jagged object array
                partialSchema.items = new PartialSchema();
                partialSchema.items.PopulateFrom(schema.items);
            }

            partialSchema.@default         = schema.@default;
            partialSchema.maximum          = schema.maximum;
            partialSchema.exclusiveMaximum = schema.exclusiveMaximum;
            partialSchema.minimum          = schema.minimum;
            partialSchema.exclusiveMinimum = schema.exclusiveMinimum;
            partialSchema.maxLength        = schema.maxLength;
            partialSchema.minLength        = schema.minLength;
            partialSchema.pattern          = schema.pattern;
            partialSchema.maxItems         = schema.maxItems;
            partialSchema.minItems         = schema.minItems;
            partialSchema.uniqueItems      = schema.uniqueItems;
            partialSchema.@enum            = schema.@enum;
            partialSchema.multipleOf       = schema.multipleOf;
        }
Exemplo n.º 2
0
 public static void PopulateFrom(this PartialSchema partialSchema, Schema schema)
 {
     if (schema == null)
     {
         return;
     }
     partialSchema.type             = schema.type;
     partialSchema.format           = schema.format;
     partialSchema.vendorExtensions = schema.vendorExtensions;
     if (schema.items != null)
     {
         partialSchema.items = new PartialSchema();
         partialSchema.items.PopulateFrom(schema.items);
     }
     partialSchema.@default         = schema.@default;
     partialSchema.maximum          = schema.maximum;
     partialSchema.exclusiveMaximum = schema.exclusiveMaximum;
     partialSchema.minimum          = schema.minimum;
     partialSchema.exclusiveMinimum = schema.exclusiveMinimum;
     partialSchema.maxLength        = schema.maxLength;
     partialSchema.minLength        = schema.minLength;
     partialSchema.pattern          = schema.pattern;
     partialSchema.maxItems         = schema.maxItems;
     partialSchema.minItems         = schema.minItems;
     partialSchema.uniqueItems      = schema.uniqueItems;
     partialSchema.@enum            = schema.@enum;
     partialSchema.multipleOf       = schema.multipleOf;
 }