# Zipper - Learnings
## [MR2](https://gitlab.com/evatix-go/zipper/-/merge_requests/2)
- Add ```range``` method in enum to check if within range
- Add ```MarshalJSON(), UnmarshalJSON() , AsJsonMarshaller()``` to enums
- Use msgtype -> ```"gitlab.com/evatix-go/core/msgtype"```
- Struct -> Jsonstring -> ```struct.String()```
- When checking bool return condition directly rather than using if/else block ```return a=b``` rather than ```if a=b {return true} else false```
- No need to stringify if nil
- If a struct has complex validation check -> use thess methods -> ```IsValid(), IsInvalid(), GetInvalidError()```
- Drop unused requirements from go.mod
- Use ```https://gitlab.com/evatix-go/errorwrapper/-/blob/develop/errdata/errstr/Collection.go#L12``` rather than ```(*errstr.Collection,*errorwrapper.Wrapper)```
<!-- ## Testing Plan
### JSON :
```json=
{
"CompressIntegratedTest": {
"ExpectedData": [""],
"InputData": [
{
"Compress": {
"PathConfig": {
"SourcePaths": [
""
],
"Destination": {
"PrefixDir": "",
"OutputDir": ""
}
},
"Options": {
"CompressionLevel": 0,
"Format": ""
},
"Overwrite": {
"IsForceWrite": true,
"IsSkipOnExistFiles": true
},
"RawConfig": {
"IsContinueOnError": true,
"IsSelectiveCompression ": true,
"IsMkdirAll": true,
"IsImplicitTopLevelFolder": true,
"StripComponents": 0,
"IsSingleThreadedCompress": true
}
}
}
],
"PackageName": "",
"MethodName": "",
"CaseHeader": ""
}
}
```
### Wrapper :
```go=
type CompressTestWrapper struct {
ExpectedData *[]string `json:"ExpectedData"`
InputData *[]*Compress `json:"InputData"`
PackageName string `json:"PackageName"`
MethodName string `json:"MethodName"`
CaseHeader string `json:"CaseHeader"`
}
```
### Cases :
```go=
var compressTestCases = CompressTestWrapper{
ExpectedData: nil,
PackageName: "zipper",
MethodName: "Compress"
CaseHeader: "compress integrated test",
InputData:[]Compress{
{
PathConfig : PathConfig{
SourcePaths : []string{"abc.txt","123.txt"},
Destination : Destination{
PrefixDir : "temp",
OutputDir : "temp.zip",
},
},
},
},
}
``` -->
## Issue with extraction
