Skip to content

Commit

Permalink
split generate Json
Browse files Browse the repository at this point in the history
  • Loading branch information
zoov-xavier committed Apr 8, 2024
1 parent 374022f commit 7dedd50
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7dedd50

Please sign in to comment.