Closed podhmo closed 3 years ago
changes to use RegisterFunc() with After() instead of Visitor.VisitFunc()
RegisterFunc() with After()
Visitor.VisitFunc()
before
c.EmitDoc(func(m *reflectopenapi.Manager) { { m.Visitor.VisitType(SortOrderAsc, func(schema *openapi3.Schema) { schema.Enum = []interface{}{ SortOrderDesc, SortOrderAsc, } }) } // WARNING: currently, it is ignored that the VisitType() effect after VisitFunc() . // So, please calling VisitType() before VisitType(). { op := m.Visitor.VisitFunc(ListTodo) m.Doc.AddOperation("/todo", "GET", op) } { op := m.Visitor.VisitFunc(GetTodo) m.Doc.AddOperation("/todo/{id}", "GET", op) } })
after
c.EmitDoc(func(m *reflectopenapi.Manager) { m.RegisterFunc(ListTodo).After(func(op *openapi3.Operation) { m.Doc.AddOperation("/todo", "GET", op) }) m.RegisterType(SortOrderAsc, func(schema *openapi3.Schema) { schema.Enum = []interface{}{ SortOrderDesc, SortOrderAsc, } }) m.RegisterFunc(GetTodo).After(func(op *openapi3.Operation) { m.Doc.AddOperation("/todo/{id}", "GET", op) }) })
changes to use
RegisterFunc() with After()
instead ofVisitor.VisitFunc()
before
after