@@ -70,14 +70,20 @@ func schemas(g *gen.Graph, spec *ogen.Spec) error {
70
70
return fmt .Errorf ("schema %q not found for edge %q on %q" , e .Type .Name , e .Name , n .Name )
71
71
}
72
72
es = es .ToNamed (e .Type .Name ).AsLocalRef ()
73
- if ! e .Unique {
74
- es = es .AsArray ()
73
+ a , err := EdgeAnnotation (e )
74
+ if err != nil {
75
+ return fmt .Errorf ("could not parse %q edge annotation for %q on %q" , e .Type .Name , e .Name , n .Name )
76
+ }
77
+ if ! a .Skip {
78
+ if ! e .Unique {
79
+ es = es .AsArray ()
80
+ }
81
+ addProperty (
82
+ spec .Components .Schemas [n .Name ],
83
+ ogen .NewProperty ().SetName (e .Name ).SetSchema (es ),
84
+ ! e .Optional ,
85
+ )
75
86
}
76
- addProperty (
77
- spec .Components .Schemas [n .Name ],
78
- ogen .NewProperty ().SetName (e .Name ).SetSchema (es ),
79
- ! e .Optional ,
80
- )
81
87
}
82
88
}
83
89
// If the SimpleModels feature is enabled to not generate a schema per response.
@@ -110,14 +116,20 @@ func schemas(g *gen.Graph, spec *ogen.Spec) error {
110
116
return fmt .Errorf ("schema %q not found for edge %q on %q" , vn , e .Name , n )
111
117
}
112
118
es = es .ToNamed (vn ).AsLocalRef ()
113
- if ! e .Unique {
114
- es = es .AsArray ()
119
+ a , err := EdgeAnnotation (e )
120
+ if err != nil {
121
+ return fmt .Errorf ("could not parse %q edge annotation for %q on %q" , e .Name , e .Name , n )
122
+ }
123
+ if ! a .Skip {
124
+ if ! e .Unique {
125
+ es = es .AsArray ()
126
+ }
127
+ addProperty (
128
+ spec .Components .Schemas [n ],
129
+ ogen .NewProperty ().SetName (e .Name ).SetSchema (es ),
130
+ ! e .Optional ,
131
+ )
115
132
}
116
- addProperty (
117
- spec .Components .Schemas [n ],
118
- ogen .NewProperty ().SetName (e .Name ).SetSchema (es ),
119
- ! e .Optional ,
120
- )
121
133
}
122
134
}
123
135
}
@@ -662,6 +674,10 @@ func EdgeOperations(e *gen.Edge) ([]Operation, error) {
662
674
if err := ant .Decode (e .Annotations [ant .Name ()]); err != nil {
663
675
return nil , err
664
676
}
677
+ // Skipped edges get no operations
678
+ if ant .Skip {
679
+ return nil , nil
680
+ }
665
681
var ops []Operation
666
682
m := make (map [Operation ]OperationConfig )
667
683
if e .Unique {
@@ -724,6 +740,13 @@ func reqBody(n *gen.Type, op Operation, allowClientUUIDs bool) (*ogen.RequestBod
724
740
if err != nil {
725
741
return nil , err
726
742
}
743
+ a , err := EdgeAnnotation (e )
744
+ if err != nil {
745
+ return nil , err
746
+ }
747
+ if a .ReadOnly || a .Skip {
748
+ continue
749
+ }
727
750
if ! e .Unique {
728
751
s = s .AsArray ()
729
752
}
0 commit comments