Skip to content

Commit

Permalink
add support for custom string formats
Browse files Browse the repository at this point in the history
  • Loading branch information
casualjim committed Feb 22, 2015
1 parent a5129f9 commit b8349c1
Show file tree
Hide file tree
Showing 46 changed files with 1,266 additions and 531 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ For a V1 I want to have this feature set completed:
- [x] JSON Pointer that knows about structs
- [x] JSON Reference that knows about structs
- [x] Passes current json schema test suite
- [ ] extended string formats
- [x] extended string formats
- [x] uuid, uuid3, uuid4, uuid5
- [x] email
- [x] uri (absolute)
Expand All @@ -82,8 +82,8 @@ For a V1 I want to have this feature set completed:
- [x] rgbcolor
- [x] date
- [x] date-time
- [ ] duration
- [ ] custom string formats
- [x] duration
- [x] custom string formats

### Later

Expand Down
3 changes: 2 additions & 1 deletion cmd/swagger/commands/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"github.com/casualjim/go-swagger/spec"
"github.com/casualjim/go-swagger/strfmt"
"github.com/casualjim/go-swagger/validate"
)

Expand All @@ -26,7 +27,7 @@ func (c *ValidateSpec) Execute(args []string) error {
return nil
}

result := validate.Spec(specDoc)
result := validate.Spec(specDoc, strfmt.Default)
if result.IsValid() {
fmt.Printf("The swagger spec at %q is valid against swagger specification %s\n", swaggerDoc, specDoc.Version())
} else {
Expand Down
35 changes: 0 additions & 35 deletions date.go

This file was deleted.

6 changes: 4 additions & 2 deletions examples/2.0/petstore/server/api/petstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/casualjim/go-swagger/errors"
"github.com/casualjim/go-swagger/middleware"
"github.com/casualjim/go-swagger/middleware/untyped"
"github.com/casualjim/go-swagger/reflection"
"github.com/casualjim/go-swagger/spec"
"github.com/casualjim/go-swagger/util"
"github.com/kr/pretty"
)

Expand Down Expand Up @@ -42,7 +42,9 @@ var createPet = swagger.OperationHandlerFunc(func(data interface{}) (interface{}
pretty.Println(data)
body := data.(map[string]interface{})["pet"]
var pet Pet
reflection.UnmarshalMap(body.(map[string]interface{}), &pet)
if err := util.FromDynamicJSON(body, &pet); err != nil {
return nil, err
}
addPet(pet)
return body, nil
})
Expand Down
193 changes: 0 additions & 193 deletions formats.go

This file was deleted.

Loading

0 comments on commit b8349c1

Please sign in to comment.