// BuildVSchema builds a VSchema from a SrvVSchema.
544297
func BuildVSchema(source *vschemapb.SrvVSchema) (vschema *VSchema, err error) {
	vschema = &VSchema{
		RoutingRules:   make(map[string]*RoutingRule),
		uniqueTables:   make(map[string]*Table),
		uniqueVindexes: make(map[string]Vindex),
		Keyspaces:      make(map[string]*KeyspaceSchema),
	}
	buildKeyspaces(source, vschema)
	resolveAutoIncrement(source, vschema)
	addDual(vschema)
	buildRoutingRule(source, vschema)
	return vschema, nil
}
867696
func (s *RdsHttpEndpointConfig) SetSchema(v string) *RdsHttpEndpointConfig {
	s.Schema = &v
	return s
}
1203332
func (b *builder) buildListSchema() *spec.Schema {
	name := definitionPrefix + util.ToRESTFriendlyName(fmt.Sprintf("%s/%s/%s", b.group, b.version, b.kind))
	doc := fmt.Sprintf("List of %s. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md", b.plural)
	s := new(spec.Schema).WithDescription(fmt.Sprintf("%s is a list of %s", b.listKind, b.kind)).
		WithRequired("items").
		SetProperty("items", *spec.ArrayProperty(spec.RefSchema(name)).WithDescription(doc)).
		SetProperty("metadata", getDefinition(listMetaType))
	addTypeMetaProperties(s)
	s.AddExtension(endpoints.ROUTE_META_GVK, []map[string]string{
		{
			"group":   b.group,
			"version": b.version,
			"kind":    b.listKind,
		},
	})
	return s
}
869195
func (s *CreateModelOutput) SetSchema(v string) *CreateModelOutput {
	s.Schema = &v
	return s
}
928905
func MustParseSchema(rawSchema string) Schema {
	s, err := ParseSchema(rawSchema)
	if err != nil {
		panic(err)
	}
	return s
}
774229
func APISchema(api *design.APIDefinition) *JSONSchema {
	api.IterateResources(func(r *design.ResourceDefinition) error {
		GenerateResourceDefinition(api, r)
		return nil
	})
	scheme := "http"
	if len(api.Schemes) > 0 {
		scheme = api.Schemes[0]
	}
	u := url.URL{Scheme: scheme, Host: api.Host}
	href := u.String()
	links := []*JSONLink{
		{
			Href: href,
			Rel:  "self",
		},
		{
			Href:   "/schema",
			Method: "GET",
			Rel:    "self",
			TargetSchema: &JSONSchema{
				Schema:               SchemaRef,
				AdditionalProperties: true,
			},
		},
	}
	s := JSONSchema{
		ID:          fmt.Sprintf("%s/schema", href),
		Title:       api.Title,
		Description: api.Description,
		Type:        JSONObject,
		Definitions: Definitions,
		Properties:  propertiesFromDefs(Definitions, "#/definitions/"),
		Links:       links,
	}
	return &s
}
801895
func (s *ExecuteSqlInput) SetSchema(v string) *ExecuteSqlInput {
	s.Schema = &v
	return s
}
314889
func JSONAvroSchema(avroSchema string) (json.RawMessage, error) {
	var raw json.RawMessage
	err := json.Unmarshal(json.RawMessage(avroSchema), &raw)
	if err != nil {
		return nil, err
	}
	return raw, err
}
1091664
func (s *LDBStore) PutSchema(schema string) error {
	s.lock.Lock()
	defer s.lock.Unlock()

	return s.db.Put(keySchema, []byte(schema))
}
1147476
func (s *GetDataSourceOutput) SetDataSourceSchema(v string) *GetDataSourceOutput {
	s.DataSourceSchema = &v
	return s
}
69941
func assertRecordSchema(s Schema) *RecordSchema {
	rs, ok := s.(*RecordSchema)
	if !ok {
		rs = &s.(*preparedRecordSchema).RecordSchema
	}
	return rs
}
528207
func buildAttributeSchema(api *design.APIDefinition, s *JSONSchema, at *design.AttributeDefinition) *JSONSchema {
	if at.View != "" {
		inner := NewJSONSchema()
		inner.Ref = MediaTypeRef(api, at.Type.(*design.MediaTypeDefinition), at.View)
		s.Merge(inner)
		return s
	}
	s.Merge(TypeSchema(api, at.Type))
	if s.Ref != "" {
		// Ref is exclusive with other fields
		return s
	}
	s.DefaultValue = toStringMap(at.DefaultValue)
	s.Description = at.Description
	s.Example = at.GenerateExample(api.RandomGenerator(), nil)
	s.ReadOnly = at.IsReadOnly()
	val := at.Validation
	if val == nil {
		return s
	}
	s.Enum = val.Values
	s.Format = val.Format
	s.Pattern = val.Pattern
	if val.Minimum != nil {
		s.Minimum = val.Minimum
	}
	if val.Maximum != nil {
		s.Maximum = val.Maximum
	}
	if val.MinLength != nil {
		switch {
		case at.Type.IsArray():
			s.MinItems = val.MinLength
		default:
			s.MinLength = val.MinLength
		}
	}
	if val.MaxLength != nil {
		switch {
		case at.Type.IsArray():
			s.MaxItems = val.MaxLength
		default:
			s.MaxLength = val.MaxLength
		}
	}
	s.Required = val.Required
	return s
}
545725
func ValidateSchema(schema, cfg string) []serror.SnapError {
	return cfgValidator.validateSchema(schema, cfg)
}
124470
func (p *Provider) GetSchema() providers.GetSchemaResponse {
	return providers.GetSchemaResponse{
		DataSources: map[string]providers.Schema{
			"terraform_remote_state": dataSourceRemoteStateGetSchema(),
		},
	}
}
55869
func (ovs OvsdbClient) GetSchema(dbName string) (*DatabaseSchema, error) {
	args := NewGetSchemaArgs(dbName)
	var reply DatabaseSchema
	err := ovs.rpcClient.Call("get_schema", args, &reply)
	if err != nil {
		return nil, err
	}
	ovs.Schema[dbName] = reply
	return &reply, err
}
823464
func NewVSchemaStats(vschema *vindexes.VSchema, errorMessage string) *VSchemaStats {
	stats := &VSchemaStats{
		Error:     errorMessage,
		Keyspaces: make([]*VSchemaKeyspaceStats, 0, len(vschema.Keyspaces)),
	}
	for n, k := range vschema.Keyspaces {
		s := &VSchemaKeyspaceStats{
			Keyspace: n,
		}
		if k.Keyspace != nil {
			s.Sharded = k.Keyspace.Sharded
			s.TableCount += len(k.Tables)
			for _, t := range k.Tables {
				s.VindexCount += len(t.ColumnVindexes) + len(t.Ordered) + len(t.Owned)
			}
		}
		if k.Error != nil {
			s.Error = k.Error.Error()
		}
		stats.Keyspaces = append(stats.Keyspaces, s)
	}
	sort.Slice(stats.Keyspaces, func(i, j int) bool { return stats.Keyspaces[i].Keyspace < stats.Keyspaces[j].Keyspace })

	return stats
}
932522
func (p *Provider) GetSchema(req *terraform.ProviderSchemaRequest) (*terraform.ProviderSchema, error) {
	resourceTypes := map[string]*configschema.Block{}
	dataSources := map[string]*configschema.Block{}

	for _, name := range req.ResourceTypes {
		if r, exists := p.ResourcesMap[name]; exists {
			resourceTypes[name] = r.CoreConfigSchema()
		}
	}
	for _, name := range req.DataSources {
		if r, exists := p.DataSourcesMap[name]; exists {
			dataSources[name] = r.CoreConfigSchema()
		}
	}

	return &terraform.ProviderSchema{
		Provider:      schemaMap(p.Schema).CoreConfigSchema(),
		ResourceTypes: resourceTypes,
		DataSources:   dataSources,
	}, nil
}