diff --git a/builder/builder.go b/builder/builder.go index 2156ff4..0c05dc6 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -157,7 +157,7 @@ func (b *Builder) ClearCache() { b.swagger.Components.Schemas = make(openapi3.Schemas) } -func (b *Builder) GenerateJson(ctx context.Context, callbacksObject shared.ChipiCallbacks) ([]byte, error) { +func (b *Builder) GenerateSwagger(ctx context.Context, callbacksObject shared.ChipiCallbacks) (*openapi3.T, error) { swagger := *b.swagger for _, m := range b.methods { @@ -228,6 +228,16 @@ func (b *Builder) GenerateJson(ctx context.Context, callbacksObject shared.Chipi swagger.Paths.Set(key, value) } + return &swagger, nil +} + +func (b *Builder) GenerateJson(ctx context.Context, callbacksObject shared.ChipiCallbacks) ([]byte, error) { + + swagger, err := b.GenerateSwagger(ctx, callbacksObject) + if err != nil { + return nil, err + } + json, err := swagger.MarshalJSON() if err != nil { return nil, err