<commit_before>package openapi3

import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"github.com/jban332/kin-openapi/jsoninfo"
	"math"
	"regexp"
	"strconv"
	"strings"
	"unicode/utf16"
)

// Float64Ptr is a helper for defining OpenAPI schemas.
func Float64Ptr(value float64) *float64 {
	return &value
}

// Int64Ptr is a helper for defining OpenAPI schemas.
func Int64Ptr(value int64) *int64 {
	return &value
}

// Schema is specified by OpenAPI/Swagger 3.0 standard.
type Schema struct {
	ExtensionProps

	OneOf        []*SchemaRef  `json:"oneOf,omitempty"`
	AnyOf        []*SchemaRef  `json:"anyOf,omitempty"`
	AllOf        []*SchemaRef  `json:"allOf,omitempty"`
	Not          *SchemaRef    `json:"not,omitempty"`
	Type         string        `json:"-" multijson:"type,omitempty"`
	Types        []string      `json:"-" multijson:"type,omitempty"`
	Format       string        `json:"format,omitempty"`
	Description  string        `json:"description,omitempty"`
	Enum         []interface{} `json:"enum,omitempty"`
	Default      interface{}   `json:"default,omitempty"`
	Example      interface{}   `json:"example,omitempty"`
	Examples     []interface{} `json:"examples,omitempty"`
	ExternalDocs interface{}   `json:"externalDocs,omitempty"`

	// Properties
	Nullable  bool        `json:"nullable,omitempty"`
	ReadOnly  bool        `json:"readOnly,omitempty"`
	WriteOnly bool        `json:"writeOnly,omitempty"`
	XML       interface{} `json:"xml,omitempty"`

	// Number
	ExclusiveMin *float64 `json:"exclusiveMin,omitempty"`
	ExclusiveMax *float64 `json:"exclusiveMax,omitempty"`
	Min          *float64 `json:"min,omitempty"`
	Max          *float64 `json:"max,omitempty"`
	Multiple     int64    `json:"multiple,omitempty"`

	// String
	MinLength       int64  `json:"minLength,omitempty"`
	MaxLength       *int64 `json:"maxLength,omitempty"`
	Pattern         string `json:"pattern,omitempty"`
	compiledPattern *compiledPattern

	// Array
	MinItems int64      `json:"minItems,omitempty"`
	MaxItems *int64     `json:"maxItems,omitempty"`
	Items    *SchemaRef `json:"items,omitempty"`

	// Object
	Required                    []string              `json:"required,omitempty"`
	Properties                  map[string]*SchemaRef `json:"properties,omitempty"`
	AdditionalProperties        *SchemaRef            `json:"-" multijson:"additionalProperties,omitempty"`
	AdditionalPropertiesAllowed bool                  `json:"-" multijson:"additionalProperties,omitempty"`
	Discriminator               string                `json:"discriminator,omitempty"`

	PatternProperties         string `json:"patternProperties,omitempty"`
	compiledPatternProperties *compiledPattern
}

func NewSchema() *Schema {
	return &Schema{}
}

func (value *Schema) MarshalJSON() ([]byte, error) {
	return jsoninfo.MarshalStrictStruct(value)
}

func (value *Schema) UnmarshalJSON(data []byte) error {
	return jsoninfo.UnmarshalStrictStruct(data, value)
}

func (value *Schema) NewRef() *SchemaRef {
	return &SchemaRef{
		Value: value,
	}
}

func NewOneOfSchema(schemas ...*Schema) *Schema {
	refs := make([]*SchemaRef, len(schemas))
	for i, schema := range schemas {
		refs[i].Value = schema
	}
	return &Schema{
		OneOf: refs,
	}
}

func NewAnyOfSchema(schemas ...*Schema) *Schema {
	refs := make([]*SchemaRef, len(schemas))
	for i, schema := range schemas {
		refs[i].Value = schema
	}
	return &Schema{
		AnyOf: refs,
	}
}

func NewAllOfSchema(schemas ...*Schema) *Schema {
	refs := make([]*SchemaRef, len(schemas))
	for i, schema := range schemas {
		refs[i].Value = schema
	}
	return &Schema{
		AllOf: refs,
	}<commit_msg>Fixed New {OneOf,AnyOf,AllOf} Schema functions which were failing to instantiate SchemaRef.<commit_after>package openapi3

import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"math"
	"regexp"
	"strconv"
	"strings"
	"unicode/utf16"

	"github.com/jban332/kin-openapi/jsoninfo"
)

// Float64Ptr is a helper for defining OpenAPI schemas.
func Float64Ptr(value float64) *float64 {
	return &value
}

// Int64Ptr is a helper for defining OpenAPI schemas.
func Int64Ptr(value int64) *int64 {
	return &value
}

// Schema is specified by OpenAPI/Swagger 3.0 standard.
type Schema struct {
	ExtensionProps

	OneOf        []*SchemaRef  `json:"oneOf,omitempty"`
	AnyOf        []*SchemaRef  `json:"anyOf,omitempty"`
	AllOf        []*SchemaRef  `json:"allOf,omitempty"`
	Not          *SchemaRef    `json:"not,omitempty"`
	Type         string        `json:"-" multijson:"type,omitempty"`
	Types        []string      `json:"-" multijson:"type,omitempty"`
	Format       string        `json:"format,omitempty"`
	Description  string        `json:"description,omitempty"`
	Enum         []interface{} `json:"enum,omitempty"`
	Default      interface{}   `json:"default,omitempty"`
	Example      interface{}   `json:"example,omitempty"`
	Examples     []interface{} `json:"examples,omitempty"`
	ExternalDocs interface{}   `json:"externalDocs,omitempty"`

	// Properties
	Nullable  bool        `json:"nullable,omitempty"`
	ReadOnly  bool        `json:"readOnly,omitempty"`
	WriteOnly bool        `json:"writeOnly,omitempty"`
	XML       interface{} `json:"xml,omitempty"`

	// Number
	ExclusiveMin *float64 `json:"exclusiveMin,omitempty"`
	ExclusiveMax *float64 `json:"exclusiveMax,omitempty"`
	Min          *float64 `json:"min,omitempty"`
	Max          *float64 `json:"max,omitempty"`
	Multiple     int64    `json:"multiple,omitempty"`

	// String
	MinLength       int64  `json:"minLength,omitempty"`
	MaxLength       *int64 `json:"maxLength,omitempty"`
	Pattern         string `json:"pattern,omitempty"`
	compiledPattern *compiledPattern

	// Array
	MinItems int64      `json:"minItems,omitempty"`
	MaxItems *int64     `json:"maxItems,omitempty"`
	Items    *SchemaRef `json:"items,omitempty"`

	// Object
	Required                    []string              `json:"required,omitempty"`
	Properties                  map[string]*SchemaRef `json:"properties,omitempty"`
	AdditionalProperties        *SchemaRef            `json:"-" multijson:"additionalProperties,omitempty"`
	AdditionalPropertiesAllowed bool                  `json:"-" multijson:"additionalProperties,omitempty"`
	Discriminator               string                `json:"discriminator,omitempty"`

	PatternProperties         string `json:"patternProperties,omitempty"`
	compiledPatternProperties *compiledPattern
}

func NewSchema() *Schema {
	return &Schema{}
}

func (value *Schema) MarshalJSON() ([]byte, error) {
	return jsoninfo.MarshalStrictStruct(value)
}

func (value *Schema) UnmarshalJSON(data []byte) error {
	return jsoninfo.UnmarshalStrictStruct(data, value)
}

func (value *Schema) NewRef() *SchemaRef {
	return &SchemaRef{
		Value: value,
	}
}

func NewOneOfSchema(schemas ...*Schema) *Schema {
	refs := make([]*SchemaRef, len(schemas))
	for i, schema := range schemas {
		refs[i] = &SchemaRef{Value: schema}
	}
	return &Schema{
		OneOf: refs,
	}
}

func NewAnyOfSchema(schemas ...*Schema) *Schema {
	refs := make([]*SchemaRef, len(schemas))
	for i, schema := range schemas {
		refs[i] = &SchemaRef{Value: schema}
	}
	return &Schema{
		AnyOf: refs,
	}
}

func NewAllOfSchema(schemas ...*Schema) *Schema {
	refs := make([]*SchemaRef, len(schemas))
	for i, schema := range schemas {
		refs[i] = &SchemaRef{Value: schema}
	}
	return &Schema{
		AllOf: refs,
	}
{'fraction_non_alphanumeric': 0.13275061458617865, 'fraction_numerical': 0.011472275334608031, 'mean_word_length': 3.6972418216805645, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3697289', 'n_tokens_mistral': 2360, 'n_tokens_neox': 2226, 'n_words': 519}