github.com/songshiyun/revive@v1.1.5-0.20220323112655-f8433a19b3c5/testdata/struct-tag.go (about)

     1  package fixtures
     2  
     3  import "time"
     4  
     5  type decodeAndValidateRequest struct {
     6  	// BEAWRE : the flag of URLParam should match the const string URLParam
     7  	URLParam         string          `json:"-" path:"url_param" validate:"numeric"`
     8  	Text             string          `json:"text" validate:"max=10"`
     9  	DefaultInt       int             `json:"defaultInt" default:"10.0"` // MATCH /field's type and default value's type mismatch/
    10  	DefaultInt2      int             `json:"defaultInt" default:"10"`
    11  	DefaultString    string          `json:"defaultString" default:"foo"`
    12  	DefaultBool      bool            `json:"defaultBool" default:"trues"` // MATCH /field's type and default value's type mismatch/
    13  	DefaultBool2     bool            `json:"defaultBool" default:"true"`
    14  	DefaultBool3     bool            `json:"defaultBool" default:"false"`
    15  	DefaultFloat     float64         `json:"defaultFloat" default:"f10.0"` // MATCH /field's type and default value's type mismatch/
    16  	DefaultFloat2    float64         `json:"defaultFloat" default:"10.0"`
    17  	MandatoryStruct  mandatoryStruct `json:"mandatoryStruct" required:"trues"` // MATCH /required should be 'true' or 'false'/
    18  	MandatoryStruct2 mandatoryStruct `json:"mandatoryStruct" required:"true"`
    19  	MandatoryStruct4 mandatoryStruct `json:"mandatoryStruct" required:"false"`
    20  	OptionalStruct   *optionalStruct `json:"optionalStruct,omitempty"`
    21  	OptionalQuery    string          `json:"-" querystring:"queryfoo"`
    22  	optionalQuery    string          `json:"-" querystring:"queryfoo"` // MATCH /tag on not-exported field optionalQuery/
    23  	// No-reg test for bug https://github.com/songshiyun/revive/issues/208
    24  	Tiret    string `json:"-,"`
    25  	BadTiret string `json:"other,"` // MATCH /option can not be empty in JSON tag/
    26  }
    27  
    28  type RangeAllocation struct {
    29  	metav1.TypeMeta   `json:",inline"` // MATCH /unknown option 'inline' in JSON tag/
    30  	metav1.ObjectMeta `json:"metadata,omitempty"`
    31  	Range             string `json:"range,flow"`  // MATCH /unknown option 'flow' in JSON tag/
    32  	Data              []byte `json:"data,inline"` // MATCH /unknown option 'inline' in JSON tag/
    33  }
    34  
    35  type RangeAllocation struct {
    36  	metav1.TypeMeta   `bson:",minsize"`
    37  	metav1.ObjectMeta `bson:"metadata,omitempty"`
    38  	Range             string `bson:"range,flow"` // MATCH /unknown option 'flow' in BSON tag/
    39  	Data              []byte `bson:"data,inline"`
    40  }
    41  
    42  type TestContextSpecificTags2 struct {
    43  	A       int       `asn1:"explicit,tag:1"`
    44  	B       int       `asn1:"tag:2"`
    45  	S       string    `asn1:"tag:0,utf8"`
    46  	Ints    []int     `asn1:"set"`
    47  	Version int       `asn1:"optional,explicit,default:0,tag:0"` // MATCH /duplicated tag number 0/
    48  	Time    time.Time `asn1:"explicit,tag:4,other"`              // MATCH /unknown option 'other' in ASN1 tag/
    49  }
    50  
    51  type VirtualMachineRelocateSpecDiskLocator struct {
    52  	DynamicData
    53  
    54  	DiskId          int32                           `xml:"diskId,attr,cdata"`
    55  	Datastore       ManagedObjectReference          `xml:"datastore,chardata,innerxml"`
    56  	DiskMoveType    string                          `xml:"diskMoveType,omitempty,comment"`
    57  	DiskBackingInfo BaseVirtualDeviceBackingInfo    `xml:"diskBackingInfo,omitempty,any"`
    58  	Profile         []BaseVirtualMachineProfileSpec `xml:"profile,omitempty,other"` // MATCH /unknown option 'other' in XML tag/
    59  }