Skip to content

Commit

Permalink
Merge pull request #2 from GraHms/feat/generate-swagger-spec
Browse files Browse the repository at this point in the history
feat: generate a basic swagger spec
  • Loading branch information
GraHms committed Apr 14, 2024
2 parents 0fd3796 + 24312a5 commit cdaf327
Show file tree
Hide file tree
Showing 7 changed files with 745 additions and 1,008 deletions.
13 changes: 3 additions & 10 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,18 @@ type Product struct {
BaseType *string `json:"@baseType" binding:"ignore"`
Type *string `json:"type" enums:"physical,digital"`
Url *string `json:"@Url" binding:"ignore"`
IsHumeid *bool `json:"isHumeid" binding:"required"`
Specification *[]Spec `json:"specification"`
Id *string `json:"id" binding:"ignore"`
}

func main() {
app := worx.NewApplication("/api", "Product Catalog API", "1.0.0", "Product Catalogue API")
app := worx.NewApplication("/api", "Product API", "1.0.0", "Product API")
productTags := router.WithTags([]string{"Product", "something"})
product := worx.NewRouter[Product, Product](app, "/products")
product.HandleCreate("", createHandler, router.WithName("product name"), productTags)
product.HandleRead("", handler, productTags)
product.HandleRead("/:id/machava", handler, productTags, router.WithAllowedHeaders([]router.AllowedFields{
{
Name: "x-tower",
Description: "",
Required: false,
},
}))
err := app.Run(":8080")
product.HandleRead("/:id", handler, productTags)
err := app.Run(":8081")
if err != nil {
panic(err)
}
Expand Down
Loading

0 comments on commit cdaf327

Please sign in to comment.