Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tolerating fields outside the structure in request body #29

Open
gopherus opened this issue Jun 9, 2023 · 0 comments
Open

Tolerating fields outside the structure in request body #29

gopherus opened this issue Jun 9, 2023 · 0 comments
Assignees

Comments

@gopherus
Copy link
Collaborator

gopherus commented Jun 9, 2023

Request:
PATCH /v1/api/dev/actor HTTP/1.1
Host: 127.0.0.1:8080
Content-Type: application/json

{
  "Entity": [
    {
      "abc":"xyz",
      "ActorId":0,
      "FirstName": "Mike",
      "LastName": "Wazowski",
      "LastUpdate": "2023-01-01T00:00:00Z"
    }
  ]
}

This request returns a proper response but shouldn't. Actor struct doesn't contain field "abc".

type Actor struct {
	ActorId    int       `sqlx:"name=actor_id,autoincrement,primaryKey,required"`
	FirstName  string    `sqlx:"name=first_name,required"`
	LastName   string    `sqlx:"name=last_name,unique,table=actor,required"`
	LastUpdate time.Time `sqlx:"name=last_update,required"`
	Has        *ActorHas `setMarker:"true" typeName:"ActorHas" json:"-"  sqlx:"-" `
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants