Closed keshy7 closed 1 year ago
Hi
I actually make changes like this a lot. To allow for reproducable generation of the client, I modify the swagger file with a script that takes the original swaggerfile and modifies it before library generation.
See https://github.com/fbreckle/go-netbox/blob/f7f714c3510360dde34f30144b5c3b9a3ff2e6ae/preprocess.py#L144 and the following lines.
Can you please:
make preprocess
for that)Thank you for the clear direction, @fbreckle! The corresponding changes are now in.
By default, Netbox's REST API sets User Token's write_enabled field to true. This means that if the field is not set explicitly in the request, Netbox would automatically set it to true.
This behavior results to an inconsistency if the value is set to false and omitempty is configured in the JSON tag. This is because by default, JSON Marshaller omits false booleans. Since the field is omitted, Netbox REST API would default it to true. Hence, an inconsistency would occur.
To fix this, simply remove the omitempty tag from the writable token.
References: