func viewSchemas(g *gen.Graph, s *spec.Spec) error {
	vs, err := newViews(g)
	if err != nil {
		return err
	}
	// Create a schema for every view.
	for n, v := range vs {
		fs := make(spec.Fields, len(v.Fields))
		// We can already add the schema fields.
		for _, f := range v.Fields {
			sf, err := newField(f)
			if err != nil {
				return err
			}
			fs[f.Name] = sf
		}
		s.Components.Schemas[n] = &spec.Schema{
			Name:   n,
			Fields: fs,
		}
	}
	// Loop over the views again and this time fill the edges.
	for n, v := range vs {
		es := make(spec.Edges, len(v.Edges))
		for _, e := range v.Edges {
			es[e.Edge.Name] = spec.Edge{
				Ref:    s.Components.Schemas[e.Name],
				Unique: e.Unique,
			}
		}
		s.Components.Schemas[n].Edges = es
	}
	return nil
}
// viewSchemas adds all views to the specs schemas.
viewSchemas adds all views to the specs schemas.
// viewSchemas adds all views to the specs schemas .
func viewSchemas(g *gen.Graph, s *spec.Spec) error {
	vs, err := newViews(g)
	if err != nil {
		return err
	}
	for n, v := range vs {
		fs := make(spec.Fields, len(v.Fields))
		for _, f := range v.Fields {
			sf, err := newField(f)
			if err != nil {
				return err
			}
			fs[f.Name] = sf
		}
		s.Components.Schemas[n] = &spec.Schema{
			Name:   n,
			Fields: fs,
		}
	}
	for n, v := range vs {
		es := make(spec.Edges, len(v.Edges))
		for _, e := range v.Edges {
			es[e.Edge.Name] = spec.Edge{
				Ref:    s.Components.Schemas[e.Name],
				Unique: e.Unique,
			}
		}
		s.Components.Schemas[n].Edges = es
	}
	return nil
}
func viewSchemas ( g * gen . Graph , s * spec . Spec ) error { vs , err := newViews ( g ) if err != nil { return err } for n , v := range vs { fs := make ( spec . Fields , len ( v . Fields ) ) for _ , f := range v . Fields { sf , err := newField ( f ) if err != nil { return err } fs [ f . Name ] = sf } s . Components . Schemas [ n ] = & spec . Schema { Name : n , Fields : fs , } } for n , v := range vs { es := make ( spec . Edges , len ( v . Edges ) ) for _ , e := range v . Edges { es [ e . Edge . Name ] = spec . Edge { Ref : s . Components . Schemas [ e . Name ] , Unique : e . Unique , } } s . Components . Schemas [ n ] . Edges = es } return nil }
viewSchemas adds all views to the specs schemas.
viewSchemas adds all views to the specs schemas .
// Create a schema for every view. // We can already add the schema fields. // Loop over the views again and this time fill the edges.