fbreckle / go-netbox

Package netbox provides an API client for DigitalOcean's NetBox IPAM and DCIM service.
Other
1 stars 22 forks source link

Delete fields that need custom serializer handling #26

Open hollow opened 1 year ago

hollow commented 1 year ago

link_peers is actually an array of objects and is not implemented properly in the swagger.json definition.

As soon as a circuit termination is connected to a device interface the Terraform provider cannot unmarshal the response anymore:

│ Error: json: cannot unmarshal object into Go struct field CircuitTermination.link_peers of type string
│ 
│   with netbox_circuit_termination.megaport-leaseweb["WDC-02"],
│   on megaport.tf line 92, in resource "netbox_circuit_termination" "megaport-leaseweb":
│   92: resource "netbox_circuit_termination" "megaport-leaseweb" {

However, this attribute is not used in the provider anyway, so I have removed it instead of trying to fix it.

fbreckle commented 1 year ago

You have to update the preprocess script to reflect your changes. Else, next time I regenerate the client from a fresh netbox swagger file, your changes are lost. The process is:

Also, circuit termination and link peers are outside my area of expertise - are link peers a feature nobody will ever need? I would prefer it to be fixed instead of being removed.

hollow commented 1 year ago

@fbreckle I have added the removal of fields that need a custom serializer implementation to the preprocessor and regenerated all files. Please let me know if this works and I'll follow up with a PR in the terraform provider.

hollow commented 1 year ago

Also, circuit termination and link peers are outside my area of expertise - are link peers a feature nobody will ever need? I would prefer it to be fixed instead of being removed.

I agree with you, but implementing custom serializers is beyond my scope (read: available time), and with the current implementation, the provider cannot be made to work to create circuit terminations

hollow commented 1 year ago

Just realized that this is now a duplicate of https://github.com/fbreckle/go-netbox/pull/28