netlify / netlify/open-api

(*models.Error) is not supported by the TextConsumer

Open
#236 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
323
Forks
133
Avg merge
2d 8h
Merged PRs (30d)
2

Description

When creating a site using the Netlify terraform provider, I get this error:

&{0 } (*models.Error) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface

I attempted to create the site via cURL to get more visibility into the API response:

Request

curl -X POST \
  https://api.netlify.com/api/v1/sites \
  -H 'Authorization: Bearer <secret>' \
  -H 'Content-Type: application/json' \
  -d '{
	"name": "test",
	"repo": {
		"provider": "github",
		"repo_path": "jaredpiedt/test",
		"repo_branch": "master"
	}
}'

Response

HTTP/1.1 422 Unprocessable Entity

{
    "errors": {
        "subdomain": [
            "must be unique"
        ]
    }
}

I believe the issue is a result of the response not matching the error schema specified in swagger.yml: https://github.com/netlify/open-api/blob/master/swagger.yml#L2777-L2787

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with swagger.yml around lines 2777-2787 and compare the documented error schema with the 422 response returned by the sites endpoint. Trace how that response reaches the TextConsumer and TextUnmarshaler handling. Done means the subdomain uniqueness error is represented and reported without the unsupported *models.Error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.