Open bflad opened 1 year ago
One quick proposal in this space could be introducing the following converter configuration:
data_sources:
TYPE:
read:
path: /instance/v1/zones/{zone}/servers
method: GET
# New!
pagination:
selection_property: page
size_property: per_page
Initially, the combination of those property names would be used to omit them from the Terraform schema. If/When the code generation specification supports passing API operation pagination information, then the converter could use these values to fill in that information.
There may also be merit to also introducing a separate "just omit these properties" converter configuration, but that feels like it could be addressed separately if/when the use case exists.
Note for future readers: If you want to ignore these properties from the Terraform schema, you can ignore them with the recently introduced schema.ignores
functionality in v0.2.0
, documented here.
Example ignoring the properties listed in this issue:
data_sources:
TYPE:
read:
path: /instance/v1/zones/{zone}/servers
method: GET
schema:
ignores:
- page
- per_page
This issue is still a valid future enhancement, as whenever a provider code spec can described operations for code generation, this pagination information will likely become relevant again.
Some APIs utilize pagination or markers for handling operations which can return a lot of data.
For example in the Scaleway OpenAPI specification there is:
Which currently results in the associated code generation specification:
These low-level API details are never intended to be surfaced in Terraform, however they are quite critical to the operation of the API in the provider logic.
In the schema-only generation use case:
In the full generation use case: