func fieldToSchema(pidl *idl.Idl, f *idl.Field) *swagger2.Schema { sc := new(swagger2.Schema) // sc.Title = f.Name sc.Description = strings.Join(f.Comments, "\n") it := typeToItems(pidl, f.Type) sc.Ref = it.Ref sc.Type = it.Type sc.Format = it.Format sc.ItemsDef.Items = it.Items sc.Enum = it.Enum sc.AdditionalProperties = it.AdditionalProperties return sc }
func returnsToSchema(pidl *idl.Idl, t *idl.Type) *swagger2.Schema { sc := new(swagger2.Schema) // sc.Title = f.Name if t.IsVoid() { // nil schema means the operation returns no content return nil } else { it := typeToItems(pidl, t) sc.Ref = it.Ref sc.Type = it.Type sc.Format = it.Format sc.ItemsDef.Items = it.Items sc.Enum = it.Enum sc.AdditionalProperties = it.AdditionalProperties } return sc }