Skip to content

Commit

Permalink
Typos (#814)
Browse files Browse the repository at this point in the history
* Typos

* Fix function names

Co-authored-by: Marcin Romaszewicz <47459980+deepmap-marcinr@users.noreply.github.com>
  • Loading branch information
Jleagle and deepmap-marcinr committed Oct 27, 2022
1 parent bc5c5d4 commit ec207c7
Show file tree
Hide file tree
Showing 30 changed files with 96 additions and 95 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -112,7 +112,7 @@ type ServerInterface interface {
These are the functions which you will implement yourself in order to create
a server conforming to the API specification. Normally, all the arguments and
parameters are stored on the `echo.Context` in handlers, so we do the tedious
work of of unmarshaling the JSON automatically, simply passing values into
work of unmarshalling the JSON automatically, simply passing values into
your handlers.

Notice that `FindPetById` takes a parameter `id int64`. All path arguments
Expand Down
8 changes: 4 additions & 4 deletions examples/petstore-expanded/chi/api/petstore.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/petstore-expanded/chi/api/petstore.go
Expand Up @@ -28,7 +28,7 @@ func NewPetStore() *PetStore {

// This function wraps sending of an error in the Error format, and
// handling the failure to marshal that.
func sendPetstoreError(w http.ResponseWriter, code int, message string) {
func sendPetStoreError(w http.ResponseWriter, code int, message string) {
petErr := Error{
Code: int32(code),
Message: message,
Expand Down Expand Up @@ -74,7 +74,7 @@ func (p *PetStore) AddPet(w http.ResponseWriter, r *http.Request) {
// We expect a NewPet object in the request body.
var newPet NewPet
if err := json.NewDecoder(r.Body).Decode(&newPet); err != nil {
sendPetstoreError(w, http.StatusBadRequest, "Invalid format for NewPet")
sendPetStoreError(w, http.StatusBadRequest, "Invalid format for NewPet")
return
}

Expand Down Expand Up @@ -105,7 +105,7 @@ func (p *PetStore) FindPetByID(w http.ResponseWriter, r *http.Request, id int64)

pet, found := p.Pets[id]
if !found {
sendPetstoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
sendPetStoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
return
}

Expand All @@ -119,7 +119,7 @@ func (p *PetStore) DeletePet(w http.ResponseWriter, r *http.Request, id int64) {

_, found := p.Pets[id]
if !found {
sendPetstoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
sendPetStoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
return
}
delete(p.Pets, id)
Expand Down
4 changes: 2 additions & 2 deletions examples/petstore-expanded/chi/petstore_test.go
Expand Up @@ -53,7 +53,7 @@ func TestPetStore(t *testing.T) {

var resultPet api.Pet
err = json.NewDecoder(rr.Body).Decode(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
assert.NoError(t, err, "error unmarshalling response")
assert.Equal(t, newPet.Name, resultPet.Name)
assert.Equal(t, *newPet.Tag, *resultPet.Tag)
})
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestPetStore(t *testing.T) {

var petError api.Error
err = json.NewDecoder(rr.Body).Decode(&petError)
assert.NoError(t, err, "error unmarshaling PetError")
assert.NoError(t, err, "error unmarshalling PetError")
assert.Equal(t, int32(http.StatusNotFound), petError.Code)

// Now, delete both real pets
Expand Down
8 changes: 4 additions & 4 deletions examples/petstore-expanded/echo/api/petstore.go
Expand Up @@ -41,7 +41,7 @@ func NewPetStore() *PetStore {

// This function wraps sending of an error in the Error format, and
// handling the failure to marshal that.
func sendPetstoreError(ctx echo.Context, code int, message string) error {
func sendPetStoreError(ctx echo.Context, code int, message string) error {
petErr := models.Error{
Code: int32(code),
Message: message,
Expand Down Expand Up @@ -86,7 +86,7 @@ func (p *PetStore) AddPet(ctx echo.Context) error {
var newPet models.NewPet
err := ctx.Bind(&newPet)
if err != nil {
return sendPetstoreError(ctx, http.StatusBadRequest, "Invalid format for NewPet")
return sendPetStoreError(ctx, http.StatusBadRequest, "Invalid format for NewPet")
}
// We now have a pet, let's add it to our "database".

Expand Down Expand Up @@ -126,7 +126,7 @@ func (p *PetStore) FindPetByID(ctx echo.Context, petId int64) error {

pet, found := p.Pets[petId]
if !found {
return sendPetstoreError(ctx, http.StatusNotFound,
return sendPetStoreError(ctx, http.StatusNotFound,
fmt.Sprintf("Could not find pet with ID %d", petId))
}
return ctx.JSON(http.StatusOK, pet)
Expand All @@ -138,7 +138,7 @@ func (p *PetStore) DeletePet(ctx echo.Context, id int64) error {

_, found := p.Pets[id]
if !found {
return sendPetstoreError(ctx, http.StatusNotFound,
return sendPetStoreError(ctx, http.StatusNotFound,
fmt.Sprintf("Could not find pet with ID %d", id))
}
delete(p.Pets, id)
Expand Down
6 changes: 3 additions & 3 deletions examples/petstore-expanded/echo/petstore_test.go
Expand Up @@ -72,7 +72,7 @@ func TestPetStore(t *testing.T) {
// sure that its fields match.
var resultPet models.Pet
err = result.UnmarshalBodyToObject(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
assert.NoError(t, err, "error unmarshalling response")
assert.Equal(t, newPet.Name, resultPet.Name)
assert.Equal(t, *newPet.Tag, *resultPet.Tag)

Expand Down Expand Up @@ -106,7 +106,7 @@ func TestPetStore(t *testing.T) {
// We should have gotten a response from the server with the new pet. Make
// sure that its fields match.
err = result.UnmarshalBodyToObject(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
assert.NoError(t, err, "error unmarshalling response")
petId2 := resultPet.Id

// Now, list all pets, we should have two
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestPetStore(t *testing.T) {
result = testutil.NewRequest().Delete("/pets/7").Go(t, e)
assert.Equal(t, http.StatusNotFound, result.Code())
err = result.UnmarshalBodyToObject(&petError)
assert.NoError(t, err, "error unmarshaling PetError")
assert.NoError(t, err, "error unmarshalling PetError")
assert.Equal(t, int32(http.StatusNotFound), petError.Code)

// Now, delete both real pets
Expand Down
8 changes: 4 additions & 4 deletions examples/petstore-expanded/gin/api/petstore.go
Expand Up @@ -40,7 +40,7 @@ func NewPetStore() *PetStore {

// This function wraps sending of an error in the Error format, and
// handling the failure to marshal that.
func sendPetstoreError(c *gin.Context, code int, message string) {
func sendPetStoreError(c *gin.Context, code int, message string) {
petErr := Error{
Code: int32(code),
Message: message,
Expand Down Expand Up @@ -84,7 +84,7 @@ func (p *PetStore) AddPet(c *gin.Context) {
var newPet NewPet
err := c.Bind(&newPet)
if err != nil {
sendPetstoreError(c, http.StatusBadRequest, "Invalid format for NewPet")
sendPetStoreError(c, http.StatusBadRequest, "Invalid format for NewPet")
return
}
// We now have a pet, let's add it to our "database".
Expand Down Expand Up @@ -114,7 +114,7 @@ func (p *PetStore) FindPetByID(c *gin.Context, petId int64) {

pet, found := p.Pets[petId]
if !found {
sendPetstoreError(c, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", petId))
sendPetStoreError(c, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", petId))
return
}
c.JSON(http.StatusOK, pet)
Expand All @@ -126,7 +126,7 @@ func (p *PetStore) DeletePet(c *gin.Context, id int64) {

_, found := p.Pets[id]
if !found {
sendPetstoreError(c, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
sendPetStoreError(c, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
}
delete(p.Pets, id)
c.Status(http.StatusNoContent)
Expand Down
4 changes: 2 additions & 2 deletions examples/petstore-expanded/gin/petstore_test.go
Expand Up @@ -35,7 +35,7 @@ func TestPetStore(t *testing.T) {

var resultPet api.Pet
err = json.NewDecoder(rr.Body).Decode(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
assert.NoError(t, err, "error unmarshalling response")
assert.Equal(t, newPet.Name, resultPet.Name)
assert.Equal(t, *newPet.Tag, *resultPet.Tag)
})
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestPetStore(t *testing.T) {

var petError api.Error
err = json.NewDecoder(rr.Body).Decode(&petError)
assert.NoError(t, err, "error unmarshaling PetError")
assert.NoError(t, err, "error unmarshalling PetError")
assert.Equal(t, int32(http.StatusNotFound), petError.Code)

// Now, delete both real pets
Expand Down
8 changes: 4 additions & 4 deletions examples/petstore-expanded/gorilla/api/petstore.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/petstore-expanded/gorilla/api/petstore.go
Expand Up @@ -28,7 +28,7 @@ func NewPetStore() *PetStore {

// This function wraps sending of an error in the Error format, and
// handling the failure to marshal that.
func sendPetstoreError(w http.ResponseWriter, code int, message string) {
func sendPetStoreError(w http.ResponseWriter, code int, message string) {
petErr := Error{
Code: int32(code),
Message: message,
Expand Down Expand Up @@ -74,7 +74,7 @@ func (p *PetStore) AddPet(w http.ResponseWriter, r *http.Request) {
// We expect a NewPet object in the request body.
var newPet NewPet
if err := json.NewDecoder(r.Body).Decode(&newPet); err != nil {
sendPetstoreError(w, http.StatusBadRequest, "Invalid format for NewPet")
sendPetStoreError(w, http.StatusBadRequest, "Invalid format for NewPet")
return
}

Expand Down Expand Up @@ -105,7 +105,7 @@ func (p *PetStore) FindPetByID(w http.ResponseWriter, r *http.Request, id int64)

pet, found := p.Pets[id]
if !found {
sendPetstoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
sendPetStoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
return
}

Expand All @@ -119,7 +119,7 @@ func (p *PetStore) DeletePet(w http.ResponseWriter, r *http.Request, id int64) {

_, found := p.Pets[id]
if !found {
sendPetstoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
sendPetStoreError(w, http.StatusNotFound, fmt.Sprintf("Could not find pet with ID %d", id))
return
}
delete(p.Pets, id)
Expand Down
4 changes: 2 additions & 2 deletions examples/petstore-expanded/gorilla/petstore_test.go
Expand Up @@ -53,7 +53,7 @@ func TestPetStore(t *testing.T) {

var resultPet api.Pet
err = json.NewDecoder(rr.Body).Decode(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
assert.NoError(t, err, "error unmarshalling response")
assert.Equal(t, newPet.Name, resultPet.Name)
assert.Equal(t, *newPet.Tag, *resultPet.Tag)
})
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestPetStore(t *testing.T) {

var petError api.Error
err = json.NewDecoder(rr.Body).Decode(&petError)
assert.NoError(t, err, "error unmarshaling PetError")
assert.NoError(t, err, "error unmarshalling PetError")
assert.Equal(t, int32(http.StatusNotFound), petError.Code)

// Now, delete both real pets
Expand Down
8 changes: 4 additions & 4 deletions examples/petstore-expanded/strict/api/petstore-server.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/petstore-expanded/strict/petstore_test.go
Expand Up @@ -53,7 +53,7 @@ func TestPetStore(t *testing.T) {

var resultPet api.Pet
err = json.NewDecoder(rr.Body).Decode(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
assert.NoError(t, err, "error unmarshalling response")
assert.Equal(t, newPet.Name, resultPet.Name)
assert.Equal(t, *newPet.Tag, *resultPet.Tag)
})
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestPetStore(t *testing.T) {

var petError api.Error
err = json.NewDecoder(rr.Body).Decode(&petError)
assert.NoError(t, err, "error unmarshaling PetError")
assert.NoError(t, err, "error unmarshalling PetError")
assert.Equal(t, int32(http.StatusNotFound), petError.Code)

// Now, delete both real pets
Expand Down
12 changes: 6 additions & 6 deletions internal/test/components/components.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/test/components/components.yaml
Expand Up @@ -234,7 +234,7 @@ components:
- $ref: '#/components/schemas/OneOfVariant2'
- $ref: '#/components/schemas/OneOfVariant3'
OneOfObject4:
description: oneOf plus fixed type - custom marshaling/unmarshaling
description: oneOf plus fixed type - custom marshaling/unmarshalling
type: object
properties:
fixedProperty:
Expand Down
2 changes: 1 addition & 1 deletion internal/test/components/components_test.go
Expand Up @@ -20,7 +20,7 @@ func assertJsonEqual(t *testing.T, j1 []byte, j2 []byte) {
}

func TestRawJSON(t *testing.T) {
// Check raw json unmarshaling
// Check raw json unmarshalling
const buf = `{"name":"bob","value1":{"present":true}}`
var dst ObjectWithJsonField
err := json.Unmarshal([]byte(buf), &dst)
Expand Down

0 comments on commit ec207c7

Please sign in to comment.