Source file src/crypto/internal/cryptotest/x509limbo/schema.go

     1  // Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.
     2  
     3  package x509limbo
     4  
     5  import "encoding/json"
     6  import "errors"
     7  import "fmt"
     8  import "reflect"
     9  import "regexp"
    10  import "time"
    11  
    12  type ExpectedResult string
    13  
    14  const ExpectedResultFAILURE ExpectedResult = "FAILURE"
    15  const ExpectedResultSUCCESS ExpectedResult = "SUCCESS"
    16  
    17  var enumValues_ExpectedResult = []interface{}{
    18  	"SUCCESS",
    19  	"FAILURE",
    20  }
    21  
    22  // UnmarshalJSON implements json.Unmarshaler.
    23  func (j *ExpectedResult) UnmarshalJSON(value []byte) error {
    24  	var v string
    25  	if err := json.Unmarshal(value, &v); err != nil {
    26  		return err
    27  	}
    28  	var ok bool
    29  	for _, expected := range enumValues_ExpectedResult {
    30  		if reflect.DeepEqual(v, expected) {
    31  			ok = true
    32  			break
    33  		}
    34  	}
    35  	if !ok {
    36  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ExpectedResult, v)
    37  	}
    38  	*j = ExpectedResult(v)
    39  	return nil
    40  }
    41  
    42  type Feature string
    43  
    44  const FeatureDenialOfService Feature = "denial-of-service"
    45  const FeatureHasCertPolicies Feature = "has-cert-policies"
    46  const FeatureHasCrl Feature = "has-crl"
    47  const FeatureHasPolicyConstraints Feature = "has-policy-constraints"
    48  const FeatureMaxChainDepth Feature = "max-chain-depth"
    49  const FeatureNameConstraintDn Feature = "name-constraint-dn"
    50  const FeatureNoCertPolicies Feature = "no-cert-policies"
    51  const FeaturePedanticPublicSuffixWildcard Feature = "pedantic-public-suffix-wildcard"
    52  const FeaturePedanticRfc5280 Feature = "pedantic-rfc5280"
    53  const FeaturePedanticSerialNumber Feature = "pedantic-serial-number"
    54  const FeaturePedanticWebpkiEku Feature = "pedantic-webpki-eku"
    55  const FeaturePedanticWebpkiSubscriberKey Feature = "pedantic-webpki-subscriber-key"
    56  const FeatureRfc5280IncompatibleWithWebpki Feature = "rfc5280-incompatible-with-webpki"
    57  
    58  var enumValues_Feature = []interface{}{
    59  	"has-policy-constraints",
    60  	"has-cert-policies",
    61  	"no-cert-policies",
    62  	"pedantic-public-suffix-wildcard",
    63  	"name-constraint-dn",
    64  	"pedantic-webpki-subscriber-key",
    65  	"pedantic-webpki-eku",
    66  	"pedantic-serial-number",
    67  	"max-chain-depth",
    68  	"pedantic-rfc5280",
    69  	"rfc5280-incompatible-with-webpki",
    70  	"denial-of-service",
    71  	"has-crl",
    72  }
    73  
    74  // UnmarshalJSON implements json.Unmarshaler.
    75  func (j *Feature) UnmarshalJSON(value []byte) error {
    76  	var v string
    77  	if err := json.Unmarshal(value, &v); err != nil {
    78  		return err
    79  	}
    80  	var ok bool
    81  	for _, expected := range enumValues_Feature {
    82  		if reflect.DeepEqual(v, expected) {
    83  			ok = true
    84  			break
    85  		}
    86  	}
    87  	if !ok {
    88  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Feature, v)
    89  	}
    90  	*j = Feature(v)
    91  	return nil
    92  }
    93  
    94  type Importance string
    95  
    96  const ImportanceCritical Importance = "critical"
    97  const ImportanceHigh Importance = "high"
    98  const ImportanceLow Importance = "low"
    99  const ImportanceMedium Importance = "medium"
   100  const ImportanceUndetermined Importance = "undetermined"
   101  
   102  var enumValues_Importance = []interface{}{
   103  	"undetermined",
   104  	"low",
   105  	"medium",
   106  	"high",
   107  	"critical",
   108  }
   109  
   110  // UnmarshalJSON implements json.Unmarshaler.
   111  func (j *Importance) UnmarshalJSON(value []byte) error {
   112  	var v string
   113  	if err := json.Unmarshal(value, &v); err != nil {
   114  		return err
   115  	}
   116  	var ok bool
   117  	for _, expected := range enumValues_Importance {
   118  		if reflect.DeepEqual(v, expected) {
   119  			ok = true
   120  			break
   121  		}
   122  	}
   123  	if !ok {
   124  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Importance, v)
   125  	}
   126  	*j = Importance(v)
   127  	return nil
   128  }
   129  
   130  type KeyUsage string
   131  
   132  const KeyUsageCRLSign KeyUsage = "cRLSign"
   133  const KeyUsageContentCommitment KeyUsage = "contentCommitment"
   134  const KeyUsageDataEncipherment KeyUsage = "dataEncipherment"
   135  const KeyUsageDecipherOnly KeyUsage = "decipherOnly"
   136  const KeyUsageDigitalSignature KeyUsage = "digitalSignature"
   137  const KeyUsageEncipherOnly KeyUsage = "encipherOnly"
   138  const KeyUsageKeyAgreement KeyUsage = "keyAgreement"
   139  const KeyUsageKeyCertSign KeyUsage = "keyCertSign"
   140  const KeyUsageKeyEncipherment KeyUsage = "keyEncipherment"
   141  
   142  var enumValues_KeyUsage = []interface{}{
   143  	"digitalSignature",
   144  	"contentCommitment",
   145  	"keyEncipherment",
   146  	"dataEncipherment",
   147  	"keyAgreement",
   148  	"keyCertSign",
   149  	"cRLSign",
   150  	"encipherOnly",
   151  	"decipherOnly",
   152  }
   153  
   154  // UnmarshalJSON implements json.Unmarshaler.
   155  func (j *KeyUsage) UnmarshalJSON(value []byte) error {
   156  	var v string
   157  	if err := json.Unmarshal(value, &v); err != nil {
   158  		return err
   159  	}
   160  	var ok bool
   161  	for _, expected := range enumValues_KeyUsage {
   162  		if reflect.DeepEqual(v, expected) {
   163  			ok = true
   164  			break
   165  		}
   166  	}
   167  	if !ok {
   168  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KeyUsage, v)
   169  	}
   170  	*j = KeyUsage(v)
   171  	return nil
   172  }
   173  
   174  type KnownEKUs string
   175  
   176  const KnownEKUsAnyExtendedKeyUsage KnownEKUs = "anyExtendedKeyUsage"
   177  const KnownEKUsClientAuth KnownEKUs = "clientAuth"
   178  const KnownEKUsCodeSigning KnownEKUs = "codeSigning"
   179  const KnownEKUsEmailProtection KnownEKUs = "emailProtection"
   180  const KnownEKUsOCSPSigning KnownEKUs = "OCSPSigning"
   181  const KnownEKUsServerAuth KnownEKUs = "serverAuth"
   182  const KnownEKUsTimeStamping KnownEKUs = "timeStamping"
   183  
   184  var enumValues_KnownEKUs = []interface{}{
   185  	"anyExtendedKeyUsage",
   186  	"serverAuth",
   187  	"clientAuth",
   188  	"codeSigning",
   189  	"emailProtection",
   190  	"timeStamping",
   191  	"OCSPSigning",
   192  }
   193  
   194  // UnmarshalJSON implements json.Unmarshaler.
   195  func (j *KnownEKUs) UnmarshalJSON(value []byte) error {
   196  	var v string
   197  	if err := json.Unmarshal(value, &v); err != nil {
   198  		return err
   199  	}
   200  	var ok bool
   201  	for _, expected := range enumValues_KnownEKUs {
   202  		if reflect.DeepEqual(v, expected) {
   203  			ok = true
   204  			break
   205  		}
   206  	}
   207  	if !ok {
   208  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KnownEKUs, v)
   209  	}
   210  	*j = KnownEKUs(v)
   211  	return nil
   212  }
   213  
   214  // The top-level testcase container.
   215  type Limbo struct {
   216  	// One or more testcases in this testsuite
   217  	Testcases []Testcase `json:"testcases"`
   218  
   219  	// The limbo schema version; this must currently always be 1
   220  	Version int `json:"version"`
   221  }
   222  
   223  // UnmarshalJSON implements json.Unmarshaler.
   224  func (j *Limbo) UnmarshalJSON(value []byte) error {
   225  	var raw map[string]interface{}
   226  	if err := json.Unmarshal(value, &raw); err != nil {
   227  		return err
   228  	}
   229  	if _, ok := raw["testcases"]; raw != nil && !ok {
   230  		return fmt.Errorf("field testcases in Limbo: required")
   231  	}
   232  	if _, ok := raw["version"]; raw != nil && !ok {
   233  		return fmt.Errorf("field version in Limbo: required")
   234  	}
   235  	type Plain Limbo
   236  	var plain Plain
   237  	if err := json.Unmarshal(value, &plain); err != nil {
   238  		return err
   239  	}
   240  	if plain.Version != 1 {
   241  		return fmt.Errorf("field %s: must be equal to %v", "version", 1)
   242  	}
   243  	*j = Limbo(plain)
   244  	return nil
   245  }
   246  
   247  type PeerKind string
   248  
   249  const PeerKindDNS PeerKind = "DNS"
   250  const PeerKindIP PeerKind = "IP"
   251  const PeerKindRFC822 PeerKind = "RFC822"
   252  
   253  var enumValues_PeerKind = []interface{}{
   254  	"RFC822",
   255  	"DNS",
   256  	"IP",
   257  }
   258  
   259  // UnmarshalJSON implements json.Unmarshaler.
   260  func (j *PeerKind) UnmarshalJSON(value []byte) error {
   261  	var v string
   262  	if err := json.Unmarshal(value, &v); err != nil {
   263  		return err
   264  	}
   265  	var ok bool
   266  	for _, expected := range enumValues_PeerKind {
   267  		if reflect.DeepEqual(v, expected) {
   268  			ok = true
   269  			break
   270  		}
   271  	}
   272  	if !ok {
   273  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PeerKind, v)
   274  	}
   275  	*j = PeerKind(v)
   276  	return nil
   277  }
   278  
   279  // Represents a peer (i.e., end entity) certificate's name (Subject or SAN).
   280  type PeerName struct {
   281  	// The kind of peer name
   282  	Kind PeerKind `json:"kind"`
   283  
   284  	// The peer's name
   285  	Value string `json:"value"`
   286  }
   287  
   288  // UnmarshalJSON implements json.Unmarshaler.
   289  func (j *PeerName) UnmarshalJSON(value []byte) error {
   290  	var raw map[string]interface{}
   291  	if err := json.Unmarshal(value, &raw); err != nil {
   292  		return err
   293  	}
   294  	if _, ok := raw["kind"]; raw != nil && !ok {
   295  		return fmt.Errorf("field kind in PeerName: required")
   296  	}
   297  	if _, ok := raw["value"]; raw != nil && !ok {
   298  		return fmt.Errorf("field value in PeerName: required")
   299  	}
   300  	type Plain PeerName
   301  	var plain Plain
   302  	if err := json.Unmarshal(value, &plain); err != nil {
   303  		return err
   304  	}
   305  	*j = PeerName(plain)
   306  	return nil
   307  }
   308  
   309  type SignatureAlgorithm string
   310  
   311  const SignatureAlgorithmDSAWITHSHA1 SignatureAlgorithm = "DSA_WITH_SHA1"
   312  const SignatureAlgorithmDSAWITHSHA224 SignatureAlgorithm = "DSA_WITH_SHA224"
   313  const SignatureAlgorithmDSAWITHSHA256 SignatureAlgorithm = "DSA_WITH_SHA256"
   314  const SignatureAlgorithmDSAWITHSHA384 SignatureAlgorithm = "DSA_WITH_SHA384"
   315  const SignatureAlgorithmDSAWITHSHA512 SignatureAlgorithm = "DSA_WITH_SHA512"
   316  const SignatureAlgorithmECDSAWITHSHA1 SignatureAlgorithm = "ECDSA_WITH_SHA1"
   317  const SignatureAlgorithmECDSAWITHSHA224 SignatureAlgorithm = "ECDSA_WITH_SHA224"
   318  const SignatureAlgorithmECDSAWITHSHA256 SignatureAlgorithm = "ECDSA_WITH_SHA256"
   319  const SignatureAlgorithmECDSAWITHSHA3224 SignatureAlgorithm = "ECDSA_WITH_SHA3_224"
   320  const SignatureAlgorithmECDSAWITHSHA3256 SignatureAlgorithm = "ECDSA_WITH_SHA3_256"
   321  const SignatureAlgorithmECDSAWITHSHA3384 SignatureAlgorithm = "ECDSA_WITH_SHA3_384"
   322  const SignatureAlgorithmECDSAWITHSHA3512 SignatureAlgorithm = "ECDSA_WITH_SHA3_512"
   323  const SignatureAlgorithmECDSAWITHSHA384 SignatureAlgorithm = "ECDSA_WITH_SHA384"
   324  const SignatureAlgorithmECDSAWITHSHA512 SignatureAlgorithm = "ECDSA_WITH_SHA512"
   325  const SignatureAlgorithmED25519 SignatureAlgorithm = "ED25519"
   326  const SignatureAlgorithmED448 SignatureAlgorithm = "ED448"
   327  const SignatureAlgorithmGOSTR34102012WITH34112012256 SignatureAlgorithm = "GOSTR3410_2012_WITH_3411_2012_256"
   328  const SignatureAlgorithmGOSTR34102012WITH34112012512 SignatureAlgorithm = "GOSTR3410_2012_WITH_3411_2012_512"
   329  const SignatureAlgorithmGOSTR341194WITH34102001 SignatureAlgorithm = "GOSTR3411_94_WITH_3410_2001"
   330  const SignatureAlgorithmRSASSAPSS SignatureAlgorithm = "RSASSA_PSS"
   331  const SignatureAlgorithmRSAWITHMD5 SignatureAlgorithm = "RSA_WITH_MD5"
   332  const SignatureAlgorithmRSAWITHSHA1 SignatureAlgorithm = "RSA_WITH_SHA1"
   333  const SignatureAlgorithmRSAWITHSHA224 SignatureAlgorithm = "RSA_WITH_SHA224"
   334  const SignatureAlgorithmRSAWITHSHA256 SignatureAlgorithm = "RSA_WITH_SHA256"
   335  const SignatureAlgorithmRSAWITHSHA3224 SignatureAlgorithm = "RSA_WITH_SHA3_224"
   336  const SignatureAlgorithmRSAWITHSHA3256 SignatureAlgorithm = "RSA_WITH_SHA3_256"
   337  const SignatureAlgorithmRSAWITHSHA3384 SignatureAlgorithm = "RSA_WITH_SHA3_384"
   338  const SignatureAlgorithmRSAWITHSHA3512 SignatureAlgorithm = "RSA_WITH_SHA3_512"
   339  const SignatureAlgorithmRSAWITHSHA384 SignatureAlgorithm = "RSA_WITH_SHA384"
   340  const SignatureAlgorithmRSAWITHSHA512 SignatureAlgorithm = "RSA_WITH_SHA512"
   341  
   342  var enumValues_SignatureAlgorithm = []interface{}{
   343  	"RSA_WITH_MD5",
   344  	"RSA_WITH_SHA1",
   345  	"RSA_WITH_SHA224",
   346  	"RSA_WITH_SHA256",
   347  	"RSA_WITH_SHA384",
   348  	"RSA_WITH_SHA512",
   349  	"RSA_WITH_SHA3_224",
   350  	"RSA_WITH_SHA3_256",
   351  	"RSA_WITH_SHA3_384",
   352  	"RSA_WITH_SHA3_512",
   353  	"RSASSA_PSS",
   354  	"ECDSA_WITH_SHA1",
   355  	"ECDSA_WITH_SHA224",
   356  	"ECDSA_WITH_SHA256",
   357  	"ECDSA_WITH_SHA384",
   358  	"ECDSA_WITH_SHA512",
   359  	"ECDSA_WITH_SHA3_224",
   360  	"ECDSA_WITH_SHA3_256",
   361  	"ECDSA_WITH_SHA3_384",
   362  	"ECDSA_WITH_SHA3_512",
   363  	"DSA_WITH_SHA1",
   364  	"DSA_WITH_SHA224",
   365  	"DSA_WITH_SHA256",
   366  	"DSA_WITH_SHA384",
   367  	"DSA_WITH_SHA512",
   368  	"ED25519",
   369  	"ED448",
   370  	"GOSTR3411_94_WITH_3410_2001",
   371  	"GOSTR3410_2012_WITH_3411_2012_256",
   372  	"GOSTR3410_2012_WITH_3411_2012_512",
   373  }
   374  
   375  // UnmarshalJSON implements json.Unmarshaler.
   376  func (j *SignatureAlgorithm) UnmarshalJSON(value []byte) error {
   377  	var v string
   378  	if err := json.Unmarshal(value, &v); err != nil {
   379  		return err
   380  	}
   381  	var ok bool
   382  	for _, expected := range enumValues_SignatureAlgorithm {
   383  		if reflect.DeepEqual(v, expected) {
   384  			ok = true
   385  			break
   386  		}
   387  	}
   388  	if !ok {
   389  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SignatureAlgorithm, v)
   390  	}
   391  	*j = SignatureAlgorithm(v)
   392  	return nil
   393  }
   394  
   395  // Represents an individual Limbo testcase.
   396  type Testcase struct {
   397  	// A list of testcase IDs that this testcase is mutually incompatible with
   398  	ConflictsWith []string `json:"conflicts_with,omitempty,omitzero"`
   399  
   400  	// A list of PEM-encoded Certificate Revocation Lists (CRLs)
   401  	Crls []string `json:"crls,omitempty,omitzero"`
   402  
   403  	// A short, Markdown-formatted description
   404  	Description string `json:"description"`
   405  
   406  	// For server (i.e. client-side) validation: the expected peer name, if any
   407  	ExpectedPeerName *TestcaseExpectedPeerName `json:"expected_peer_name,omitempty,omitzero"`
   408  
   409  	// For client (i.e. server-side) validation: the expected peer names
   410  	ExpectedPeerNames []PeerName `json:"expected_peer_names"`
   411  
   412  	// The expected validation result
   413  	ExpectedResult ExpectedResult `json:"expected_result"`
   414  
   415  	// A constraining list of extended key usages, either in well-known form or as
   416  	// OIDs
   417  	ExtendedKeyUsage []KnownEKUs `json:"extended_key_usage"`
   418  
   419  	// Zero or more human-readable tags that describe OPTIONAL functionality described
   420  	// by this testcase. Implementers should use this to specify testcases for
   421  	// non-mandatory X.509 behavior (like certificate policy validation) or for
   422  	// 'pedantic' cases. Consumers that don't understand a given feature should skip
   423  	// tests that are marked with it.
   424  	Features []Feature `json:"features,omitempty,omitzero"`
   425  
   426  	// A short, unique identifier for this testcase
   427  	Id string `json:"id"`
   428  
   429  	// The testcase's importance
   430  	Importance Importance `json:"importance,omitempty,omitzero"`
   431  
   432  	// A constraining list of key usages
   433  	KeyUsage []KeyUsage `json:"key_usage"`
   434  
   435  	// The maximum chain-building depth
   436  	MaxChainDepth interface{} `json:"max_chain_depth,omitempty,omitzero"`
   437  
   438  	// The PEM-encoded peer (EE) certificate
   439  	PeerCertificate string `json:"peer_certificate"`
   440  
   441  	// The PEM-encoded private key for the peer certificate, if present
   442  	PeerCertificateKey interface{} `json:"peer_certificate_key,omitempty,omitzero"`
   443  
   444  	// A list of acceptable signature algorithms to constrain against
   445  	SignatureAlgorithms []SignatureAlgorithm `json:"signature_algorithms"`
   446  
   447  	// A list of PEM-encoded CA certificates to consider trusted
   448  	TrustedCerts []string `json:"trusted_certs"`
   449  
   450  	// A list of PEM-encoded untrusted intermediates to use during path building
   451  	UntrustedIntermediates []string `json:"untrusted_intermediates"`
   452  
   453  	// The kind of validation to perform
   454  	ValidationKind ValidationKind `json:"validation_kind"`
   455  
   456  	// The time at which to perform the validation
   457  	ValidationTime interface{} `json:"validation_time,omitempty,omitzero"`
   458  }
   459  
   460  // For server (i.e. client-side) validation: the expected peer name, if any
   461  type TestcaseExpectedPeerName struct {
   462  	// The kind of peer name
   463  	Kind PeerKind `json:"kind"`
   464  
   465  	// The peer's name
   466  	Value string `json:"value"`
   467  }
   468  
   469  // UnmarshalJSON implements json.Unmarshaler.
   470  func (j *TestcaseExpectedPeerName) UnmarshalJSON(value []byte) error {
   471  	var raw map[string]interface{}
   472  	if err := json.Unmarshal(value, &raw); err != nil {
   473  		return err
   474  	}
   475  	var testcaseExpectedPeerName_0 TestcaseExpectedPeerName_0
   476  	var errs []error
   477  	if err := testcaseExpectedPeerName_0.UnmarshalJSON(value); err != nil {
   478  		errs = append(errs, err)
   479  	}
   480  	if len(errs) == 1 {
   481  		return fmt.Errorf("all validators failed: %s", errors.Join(errs...))
   482  	}
   483  	type Plain TestcaseExpectedPeerName
   484  	var plain Plain
   485  	if err := json.Unmarshal(value, &plain); err != nil {
   486  		return err
   487  	}
   488  	*j = TestcaseExpectedPeerName(plain)
   489  	return nil
   490  }
   491  
   492  type TestcaseMaxChainDepth_0 *int
   493  
   494  type TestcasePeerCertificateKey_0 *string
   495  
   496  type TestcaseValidationTime_0 *time.Time
   497  
   498  // UnmarshalJSON implements json.Unmarshaler.
   499  func (j *Testcase) UnmarshalJSON(value []byte) error {
   500  	var raw map[string]interface{}
   501  	if err := json.Unmarshal(value, &raw); err != nil {
   502  		return err
   503  	}
   504  	if _, ok := raw["description"]; raw != nil && !ok {
   505  		return fmt.Errorf("field description in Testcase: required")
   506  	}
   507  	if _, ok := raw["expected_peer_names"]; raw != nil && !ok {
   508  		return fmt.Errorf("field expected_peer_names in Testcase: required")
   509  	}
   510  	if _, ok := raw["expected_result"]; raw != nil && !ok {
   511  		return fmt.Errorf("field expected_result in Testcase: required")
   512  	}
   513  	if _, ok := raw["extended_key_usage"]; raw != nil && !ok {
   514  		return fmt.Errorf("field extended_key_usage in Testcase: required")
   515  	}
   516  	if _, ok := raw["id"]; raw != nil && !ok {
   517  		return fmt.Errorf("field id in Testcase: required")
   518  	}
   519  	if _, ok := raw["key_usage"]; raw != nil && !ok {
   520  		return fmt.Errorf("field key_usage in Testcase: required")
   521  	}
   522  	if _, ok := raw["peer_certificate"]; raw != nil && !ok {
   523  		return fmt.Errorf("field peer_certificate in Testcase: required")
   524  	}
   525  	if _, ok := raw["signature_algorithms"]; raw != nil && !ok {
   526  		return fmt.Errorf("field signature_algorithms in Testcase: required")
   527  	}
   528  	if _, ok := raw["trusted_certs"]; raw != nil && !ok {
   529  		return fmt.Errorf("field trusted_certs in Testcase: required")
   530  	}
   531  	if _, ok := raw["untrusted_intermediates"]; raw != nil && !ok {
   532  		return fmt.Errorf("field untrusted_intermediates in Testcase: required")
   533  	}
   534  	if _, ok := raw["validation_kind"]; raw != nil && !ok {
   535  		return fmt.Errorf("field validation_kind in Testcase: required")
   536  	}
   537  	type Plain Testcase
   538  	var plain Plain
   539  	if err := json.Unmarshal(value, &plain); err != nil {
   540  		return err
   541  	}
   542  	if v, ok := raw["conflicts_with"]; !ok || v == nil {
   543  		plain.ConflictsWith = []string{}
   544  	}
   545  	if v, ok := raw["crls"]; !ok || v == nil {
   546  		plain.Crls = []string{}
   547  	}
   548  	if v, ok := raw["features"]; !ok || v == nil {
   549  		plain.Features = []Feature{}
   550  	}
   551  	if matched, _ := regexp.MatchString(`^([A-Za-z][A-Za-z0-9-.]+::)*([A-Za-z][A-Za-z0-9-.]+)$`, string(plain.Id)); !matched {
   552  		return fmt.Errorf("field %s pattern match: must match %s", "Id", `^([A-Za-z][A-Za-z0-9-.]+::)*([A-Za-z][A-Za-z0-9-.]+)$`)
   553  	}
   554  	if v, ok := raw["importance"]; !ok || v == nil {
   555  		plain.Importance = "undetermined"
   556  	}
   557  	*j = Testcase(plain)
   558  	return nil
   559  }
   560  
   561  type ValidationKind string
   562  
   563  const ValidationKindCLIENT ValidationKind = "CLIENT"
   564  const ValidationKindSERVER ValidationKind = "SERVER"
   565  
   566  var enumValues_ValidationKind = []interface{}{
   567  	"CLIENT",
   568  	"SERVER",
   569  }
   570  
   571  // UnmarshalJSON implements json.Unmarshaler.
   572  func (j *ValidationKind) UnmarshalJSON(value []byte) error {
   573  	var v string
   574  	if err := json.Unmarshal(value, &v); err != nil {
   575  		return err
   576  	}
   577  	var ok bool
   578  	for _, expected := range enumValues_ValidationKind {
   579  		if reflect.DeepEqual(v, expected) {
   580  			ok = true
   581  			break
   582  		}
   583  	}
   584  	if !ok {
   585  		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ValidationKind, v)
   586  	}
   587  	*j = ValidationKind(v)
   588  	return nil
   589  }
   590  
   591  type TestcaseExpectedPeerName_0 = PeerName
   592  

View as plain text