Skip to content

Commit

Permalink
feat(server): add swagger UI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
crStiv authored Dec 25, 2024
1 parent 4ed5650 commit 2ac2555
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions server/v2/api/swagger/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package swagger

import "github.com/cosmos/cosmos-sdk/server/v2/config"

// Config represents Swagger configuration options
type Config struct {
// Enable enables the Swagger UI endpoint
Enable bool `mapstructure:"enable"`
// Path is the URL path where Swagger UI will be served
Path string `mapstructure:"path"`
}

// DefaultConfig returns default configuration for Swagger
func DefaultConfig() Config {
return Config{
Enable: false,
Path: "/swagger",
}
}

// Validate validates the configuration
func (c Config) Validate() error {
if c.Path == "" {
return fmt.Errorf("swagger path cannot be empty")
}
return nil
}

0 comments on commit 2ac2555

Please sign in to comment.