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

Type information for @google-cloud/dns Record/Metadata does not match API documentation nor real data #6017

Open
7 tasks done
mgabeler-lee-6rs opened this issue Feb 5, 2025 · 0 comments
Labels
size: s type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mgabeler-lee-6rs
Copy link

Please make sure you have searched for information in the following guides.

A screenshot that you have tested with "Try this API".

This is a problem with declared types, not with running the API

Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.

This is a problem with declared types, not with running the API

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

  1. Call await new DNS(...).zone('...').getRecords()
  2. Compare actual responses to the declared types for the returned Records and their metadata: RecordMetadata fields:
    • Record.data is typically an array of strings, not a single non-array object. The fact that it's an array is clear from the constructors in the source that assign it based on rrdatas, which is declared as an array
    • RecordMetadata has an rrdatas field commonly, not a data one as declared. Clearly visible in the underlying API documentation: https://cloud.google.com/dns/docs/reference/rest/v1/resourceRecordSets#ResourceRecordSet
    • rrdatas in the REST API are clearly declared as strings, but this library declares them as {} (object)

As such it's very hard to use at least this part of the library without casting everything to any or otherwise turning off type checking, defeating the point of having types.

A clear and concise description of what the bug is, and what you expected to happen.

The types for objects returned from API calls should match the API

A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

That's the whole point of having types, to tell you what fields exist and what types of values they are supposed to contain

@sofisl sofisl added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. size: s labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants