* feat: generate fields validation and use it when issuing requests to API with soft (default) or hard modes
* chore: apply linter fixes
* feat: enable field validation on int fields
* feat: add validation for ^[\w]+$ fields
* feat: add validation for MAC address fields
* fix: trim wrappers for all comments
* feat: add validation for IPv4, IPv6 and IP(IPv4/IPv6) fields
* feat: add validation for numeric, non-zero based fields
* fix: one of validation can contain dot (.) sign in values
* feat: add second notation of MAC address validation
* fix: one of validation can start with ^( and end with )$
* feat: add option to disable validation and use soft validation by default
* chore: fix test
* docs: add readme about client-side validation
The `unifi_settings_mgmt` resource fails for me with the following error:
```
Error: unable to decode body: GET s/default/get/setting/mgmt unable to unmarshal alias: json: cannot unmarshal object into Go struct field .x_ssh_keys of type string
```
My `x_ssh_keys` looks like this:
```
[
{
"name": "Laptop",
"type": "ssh-rsa",
"key": "REDACTED",
"comment": "REDACTED",
"date": "2021-02-25T08:26:04Z",
"fingerprint": "REDACTED"
}
]
```
This commit changes the code generator to generate a `UnmarshalJSON` for each
struct, so that if unmarshalled it properly handles UniFis varying integer values
via the `emptyStringInt` type.
Structs not including a field of `int` type will still have the function generated,
but it will effectively do nothing.
Fixes#18
* Allows for generating top-level types for any embedded struct so
that sub-types can be properly instantiated from calling code
* Specifying `-no-embedded-types` will generate top-level types
rather than embedding the struct
* Refactored "Device" API
* All fields set to `omitempty` because it describes all possible
device types, so effectively any field could be omitted any time
* Fixed `get` call for "Device" API; replacing `rest` with `stat`
* Generated `get` and `update` calls for `Setting*` APIs
* Added `5.14.23` JSON files