netlify / netlify/open-api

Fix Incorrect DNS Zone API Specifications

Open
#511 1 comment 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

The spec for the /getDnsZone and /getDnsZones API calls say that they return JSON where the value for key "domain" is a string. However, these calls return a JSON object for the key "domain".

I ran into this problem when trying to use the go client library and this inconsistency with spec and implementation means that JSON parsing the response fails.

This issue can be reproduced with the following curl commands:

/getDnsZones
curl -H "Authorization: Bearer <personal_access_token>" https://api.netlify.com/api/v1/dns_zones/
/getDnsZone
curl -H "Authorization: Bearer <personal_access_token>" https://api.netlify.com/api/v1/dns_zones/<zone_id>/

The response I receive from these two API calls has the following type of JSON object for the "domain" key:

  "domain": {
    "id": string
    "name": string
    "user_id": string
    "created_at": string
    "updated_at": string
    "expires_at": string
    "registered_at": string
    "renewal_price": number
    "auto_renew": bool
    "auth_code": ??? (I got null),
    "transferred_at": ??? (I got null)
    "auto_renew_at": string
  }

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

Use the /getDnsZone and /getDnsZones operations as entry points, then locate their response schemas in the OpenAPI specification. Compare the documented domain field with the object returned by the provided curl requests and update the schema so the generated Go client can parse it. Done means both operations describe domain consistently with the observed response.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.