Repository: ogen-go/ogen
Pull request #135 (2022-01-26 09:47:45)

fix: correct nullable enums support


Patch:
diff --git a/examples/ex_github/oas_json_gen.go b/examples/ex_github/oas_json_gen.go
index e420c339..20b1e2b4 100644
--- a/examples/ex_github/oas_json_gen.go
+++ b/examples/ex_github/oas_json_gen.go
@@ -64233,108 +64233,6 @@ func (o *NilCheckRunCheckSuite) Decode(d *jx.Decoder) error {
 	}
 }
 
-// Encode encodes CheckRunConclusion as json.
-func (o NilCheckRunConclusion) Encode(e *jx.Writer) {
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes CheckRunConclusion from json.
-func (o *NilCheckRunConclusion) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode NilCheckRunConclusion to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v CheckRunConclusion
-		o.Value = v
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading NilCheckRunConclusion`, d.Next())
-	}
-}
-
-// Encode encodes CheckSuiteConclusion as json.
-func (o NilCheckSuiteConclusion) Encode(e *jx.Writer) {
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes CheckSuiteConclusion from json.
-func (o *NilCheckSuiteConclusion) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode NilCheckSuiteConclusion to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v CheckSuiteConclusion
-		o.Value = v
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading NilCheckSuiteConclusion`, d.Next())
-	}
-}
-
-// Encode encodes CheckSuiteStatus as json.
-func (o NilCheckSuiteStatus) Encode(e *jx.Writer) {
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes CheckSuiteStatus from json.
-func (o *NilCheckSuiteStatus) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode NilCheckSuiteStatus to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v CheckSuiteStatus
-		o.Value = v
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading NilCheckSuiteStatus`, d.Next())
-	}
-}
-
 // Encode encodes CodeScanningAlertDismissedAt as json.
 func (o NilCodeScanningAlertDismissedAt) Encode(e *jx.Writer) {
 	if o.Null {
@@ -64844,40 +64742,6 @@ func (o *NilNullableTeamSimple) Decode(d *jx.Decoder) error {
 	}
 }
 
-// Encode encodes PageStatus as json.
-func (o NilPageStatus) Encode(e *jx.Writer) {
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes PageStatus from json.
-func (o *NilPageStatus) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode NilPageStatus to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v PageStatus
-		o.Value = v
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading NilPageStatus`, d.Next())
-	}
-}
-
 // Encode encodes PullRequestHeadRepo as json.
 func (o NilPullRequestHeadRepo) Encode(e *jx.Writer) {
 	if o.Null {
@@ -75935,6 +75799,81 @@ func (o *OptCodeScanningAlertLocation) Decode(d *jx.Decoder) error {
 	}
 }
 
+// Encode encodes CodeScanningAlertRuleSecuritySeverityLevel as json.
+func (o OptCodeScanningAlertRuleSecuritySeverityLevel) Encode(e *jx.Writer) {
+	if !o.Set {
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes CodeScanningAlertRuleSecuritySeverityLevel from json.
+func (o *OptCodeScanningAlertRuleSecuritySeverityLevel) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode OptCodeScanningAlertRuleSecuritySeverityLevel to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Set = true
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading OptCodeScanningAlertRuleSecuritySeverityLevel`, d.Next())
+	}
+}
+
+// Encode encodes CodeScanningAlertRuleSeverity as json.
+func (o OptCodeScanningAlertRuleSeverity) Encode(e *jx.Writer) {
+	if !o.Set {
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes CodeScanningAlertRuleSeverity from json.
+func (o *OptCodeScanningAlertRuleSeverity) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode OptCodeScanningAlertRuleSeverity to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Set = true
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading OptCodeScanningAlertRuleSeverity`, d.Next())
+	}
+}
+
+// Encode encodes CodeScanningAlertRuleSummarySeverity as json.
+func (o OptCodeScanningAlertRuleSummarySeverity) Encode(e *jx.Writer) {
+	if !o.Set {
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes CodeScanningAlertRuleSummarySeverity from json.
+func (o *OptCodeScanningAlertRuleSummarySeverity) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode OptCodeScanningAlertRuleSummarySeverity to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Set = true
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading OptCodeScanningAlertRuleSummarySeverity`, d.Next())
+	}
+}
+
 // Encode encodes CodeScanningAlertState as json.
 func (o OptCodeScanningAlertState) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -78225,123 +78164,6 @@ func (o *OptNilCodeScanningAlertDismissedReason) Decode(d *jx.Decoder) error {
 	}
 }
 
-// Encode encodes CodeScanningAlertRuleSecuritySeverityLevel as json.
-func (o OptNilCodeScanningAlertRuleSecuritySeverityLevel) Encode(e *jx.Writer) {
-	if !o.Set {
-		return
-	}
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes CodeScanningAlertRuleSecuritySeverityLevel from json.
-func (o *OptNilCodeScanningAlertRuleSecuritySeverityLevel) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode OptNilCodeScanningAlertRuleSecuritySeverityLevel to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Set = true
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v CodeScanningAlertRuleSecuritySeverityLevel
-		o.Value = v
-		o.Set = true
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading OptNilCodeScanningAlertRuleSecuritySeverityLevel`, d.Next())
-	}
-}
-
-// Encode encodes CodeScanningAlertRuleSeverity as json.
-func (o OptNilCodeScanningAlertRuleSeverity) Encode(e *jx.Writer) {
-	if !o.Set {
-		return
-	}
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes CodeScanningAlertRuleSeverity from json.
-func (o *OptNilCodeScanningAlertRuleSeverity) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode OptNilCodeScanningAlertRuleSeverity to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Set = true
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v CodeScanningAlertRuleSeverity
-		o.Value = v
-		o.Set = true
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading OptNilCodeScanningAlertRuleSeverity`, d.Next())
-	}
-}
-
-// Encode encodes CodeScanningAlertRuleSummarySeverity as json.
-func (o OptNilCodeScanningAlertRuleSummarySeverity) Encode(e *jx.Writer) {
-	if !o.Set {
-		return
-	}
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes CodeScanningAlertRuleSummarySeverity from json.
-func (o *OptNilCodeScanningAlertRuleSummarySeverity) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode OptNilCodeScanningAlertRuleSummarySeverity to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Set = true
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v CodeScanningAlertRuleSummarySeverity
-		o.Value = v
-		o.Set = true
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading OptNilCodeScanningAlertRuleSummarySeverity`, d.Next())
-	}
-}
-
 // Encode encodes CodeScanningAnalysisToolGUID as json.
 func (o OptNilCodeScanningAnalysisToolGUID) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -79140,45 +78962,6 @@ func (o *OptNilNullableTeamSimple) Decode(d *jx.Decoder) error {
 	}
 }
 
-// Encode encodes PageProtectedDomainState as json.
-func (o OptNilPageProtectedDomainState) Encode(e *jx.Writer) {
-	if !o.Set {
-		return
-	}
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes PageProtectedDomainState from json.
-func (o *OptNilPageProtectedDomainState) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode OptNilPageProtectedDomainState to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Set = true
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v PageProtectedDomainState
-		o.Value = v
-		o.Set = true
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading OptNilPageProtectedDomainState`, d.Next())
-	}
-}
-
 // Encode encodes PagesHealthCheckAltDomain as json.
 func (o OptNilPagesHealthCheckAltDomain) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -79218,45 +79001,6 @@ func (o *OptNilPagesHealthCheckAltDomain) Decode(d *jx.Decoder) error {
 	}
 }
 
-// Encode encodes PullRequestReviewCommentStartSide as json.
-func (o OptNilPullRequestReviewCommentStartSide) Encode(e *jx.Writer) {
-	if !o.Set {
-		return
-	}
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes PullRequestReviewCommentStartSide from json.
-func (o *OptNilPullRequestReviewCommentStartSide) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode OptNilPullRequestReviewCommentStartSide to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Set = true
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v PullRequestReviewCommentStartSide
-		o.Value = v
-		o.Set = true
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading OptNilPullRequestReviewCommentStartSide`, d.Next())
-	}
-}
-
 // Encode encodes []ReposCreateOrUpdateEnvironmentReqReviewersItem as json.
 func (o OptNilReposCreateOrUpdateEnvironmentReqReviewersItemArray) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -79370,45 +79114,6 @@ func (o *OptNilRepositoryTemplateRepository) Decode(d *jx.Decoder) error {
 	}
 }
 
-// Encode encodes ReviewCommentStartSide as json.
-func (o OptNilReviewCommentStartSide) Encode(e *jx.Writer) {
-	if !o.Set {
-		return
-	}
-	if o.Null {
-		e.Null()
-		return
-	}
-	e.Str(string(o.Value))
-}
-
-// Decode decodes ReviewCommentStartSide from json.
-func (o *OptNilReviewCommentStartSide) Decode(d *jx.Decoder) error {
-	if o == nil {
-		return errors.New(`invalid: unable to decode OptNilReviewCommentStartSide to nil`)
-	}
-	switch d.Next() {
-	case jx.String:
-		o.Set = true
-		o.Null = false
-		if err := o.Value.Decode(d); err != nil {
-			return err
-		}
-		return nil
-	case jx.Null:
-		if err := d.Null(); err != nil {
-			return err
-		}
-		var v ReviewCommentStartSide
-		o.Value = v
-		o.Set = true
-		o.Null = true
-		return nil
-	default:
-		return errors.Errorf(`unexpected type %q while reading OptNilReviewCommentStartSide`, d.Next())
-	}
-}
-
 // Encode encodes SecretScanningAlertResolution as json.
 func (o OptNilSecretScanningAlertResolution) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -80581,6 +80286,31 @@ func (o *OptPackagesListPackagesForUserVisibility) Decode(d *jx.Decoder) error {
 	}
 }
 
+// Encode encodes PageProtectedDomainState as json.
+func (o OptPageProtectedDomainState) Encode(e *jx.Writer) {
+	if !o.Set {
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes PageProtectedDomainState from json.
+func (o *OptPageProtectedDomainState) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode OptPageProtectedDomainState to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Set = true
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading OptPageProtectedDomainState`, d.Next())
+	}
+}
+
 // Encode encodes PagesHTTPSCertificate as json.
 func (o OptPagesHTTPSCertificate) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -81356,6 +81086,31 @@ func (o *OptPullRequestReviewCommentSide) Decode(d *jx.Decoder) error {
 	}
 }
 
+// Encode encodes PullRequestReviewCommentStartSide as json.
+func (o OptPullRequestReviewCommentStartSide) Encode(e *jx.Writer) {
+	if !o.Set {
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes PullRequestReviewCommentStartSide from json.
+func (o *OptPullRequestReviewCommentStartSide) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode OptPullRequestReviewCommentStartSide to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Set = true
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading OptPullRequestReviewCommentStartSide`, d.Next())
+	}
+}
+
 // Encode encodes PullsCreateReviewCommentReqSide as json.
 func (o OptPullsCreateReviewCommentReqSide) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -83517,6 +83272,31 @@ func (o *OptReviewCommentSide) Decode(d *jx.Decoder) error {
 	}
 }
 
+// Encode encodes ReviewCommentStartSide as json.
+func (o OptReviewCommentStartSide) Encode(e *jx.Writer) {
+	if !o.Set {
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes ReviewCommentStartSide from json.
+func (o *OptReviewCommentStartSide) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode OptReviewCommentStartSide to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Set = true
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading OptReviewCommentStartSide`, d.Next())
+	}
+}
+
 // Encode encodes RunnerLabelsItemType as json.
 func (o OptRunnerLabelsItemType) Encode(e *jx.Writer) {
 	if !o.Set {
diff --git a/examples/ex_github/oas_schemas_gen.go b/examples/ex_github/oas_schemas_gen.go
index b41610c0..ba9bf756 100644
--- a/examples/ex_github/oas_schemas_gen.go
+++ b/examples/ex_github/oas_schemas_gen.go
@@ -2312,7 +2312,7 @@ type CheckRun struct {
 	HTMLURL      NilString              `json:"html_url"`
 	DetailsURL   NilString              `json:"details_url"`
 	Status       CheckRunStatus         `json:"status"`
-	Conclusion   NilCheckRunConclusion  `json:"conclusion"`
+	Conclusion   CheckRunConclusion     `json:"conclusion"`
 	StartedAt    NilTime                `json:"started_at"`
 	CompletedAt  NilTime                `json:"completed_at"`
 	Output       CheckRunOutput         `json:"output"`
@@ -2357,23 +2357,23 @@ const (
 
 // Ref: #/components/schemas/check-suite
 type CheckSuite struct {
-	ID                   int                     `json:"id"`
-	NodeID               string                  `json:"node_id"`
-	HeadBranch           NilString               `json:"head_branch"`
-	HeadSha              string                  `json:"head_sha"`
-	Status               NilCheckSuiteStatus     `json:"status"`
-	Conclusion           NilCheckSuiteConclusion `json:"conclusion"`
-	URL                  NilString               `json:"url"`
-	Before               NilString               `json:"before"`
-	After                NilString               `json:"after"`
-	PullRequests         []PullRequestMinimal    `json:"pull_requests"`
-	App                  NilNullableIntegration  `json:"app"`
-	Repository           MinimalRepository       `json:"repository"`
-	CreatedAt            NilTime                 `json:"created_at"`
-	UpdatedAt            NilTime                 `json:"updated_at"`
-	HeadCommit           SimpleCommit            `json:"head_commit"`
-	LatestCheckRunsCount int                     `json:"latest_check_runs_count"`
-	CheckRunsURL         string                  `json:"check_runs_url"`
+	ID                   int                    `json:"id"`
+	NodeID               string                 `json:"node_id"`
+	HeadBranch           NilString              `json:"head_branch"`
+	HeadSha              string                 `json:"head_sha"`
+	Status               CheckSuiteStatus       `json:"status"`
+	Conclusion           CheckSuiteConclusion   `json:"conclusion"`
+	URL                  NilString              `json:"url"`
+	Before               NilString              `json:"before"`
+	After                NilString              `json:"after"`
+	PullRequests         []PullRequestMinimal   `json:"pull_requests"`
+	App                  NilNullableIntegration `json:"app"`
+	Repository           MinimalRepository      `json:"repository"`
+	CreatedAt            NilTime                `json:"created_at"`
+	UpdatedAt            NilTime                `json:"updated_at"`
+	HeadCommit           SimpleCommit           `json:"head_commit"`
+	LatestCheckRunsCount int                    `json:"latest_check_runs_count"`
+	CheckRunsURL         string                 `json:"check_runs_url"`
 }
 
 type CheckSuiteConclusion string
@@ -2597,14 +2597,14 @@ type CodeScanningAlertLocation struct {
 
 // Ref: #/components/schemas/code-scanning-alert-rule
 type CodeScanningAlertRule struct {
-	ID                    OptNilString                                     `json:"id"`
-	Name                  OptString                                        `json:"name"`
-	Severity              OptNilCodeScanningAlertRuleSeverity              `json:"severity"`
-	SecuritySeverityLevel OptNilCodeScanningAlertRuleSecuritySeverityLevel `json:"security_severity_level"`
-	Description           OptString                                        `json:"description"`
-	FullDescription       OptString                                        `json:"full_description"`
-	Tags                  OptNilStringArray                                `json:"tags"`
-	Help                  OptNilString                                     `json:"help"`
+	ID                    OptNilString                                  `json:"id"`
+	Name                  OptString                                     `json:"name"`
+	Severity              OptCodeScanningAlertRuleSeverity              `json:"severity"`
+	SecuritySeverityLevel OptCodeScanningAlertRuleSecuritySeverityLevel `json:"security_severity_level"`
+	Description           OptString                                     `json:"description"`
+	FullDescription       OptString                                     `json:"full_description"`
+	Tags                  OptNilStringArray                             `json:"tags"`
+	Help                  OptNilString                                  `json:"help"`
 }
 
 type CodeScanningAlertRuleSecuritySeverityLevel string
@@ -2627,10 +2627,10 @@ const (
 
 // Ref: #/components/schemas/code-scanning-alert-rule-summary
 type CodeScanningAlertRuleSummary struct {
-	ID          OptNilString                               `json:"id"`
-	Name        OptString                                  `json:"name"`
-	Severity    OptNilCodeScanningAlertRuleSummarySeverity `json:"severity"`
-	Description OptString                                  `json:"description"`
+	ID          OptNilString                            `json:"id"`
+	Name        OptString                               `json:"name"`
+	Severity    OptCodeScanningAlertRuleSummarySeverity `json:"severity"`
+	Description OptString                               `json:"description"`
 }
 
 type CodeScanningAlertRuleSummarySeverity string
@@ -6931,120 +6931,6 @@ func (o NilCheckRunCheckSuite) Or(d CheckRunCheckSuite) CheckRunCheckSuite {
 	return d
 }
 
-// NewNilCheckRunConclusion returns new NilCheckRunConclusion with value set to v.
-func NewNilCheckRunConclusion(v CheckRunConclusion) NilCheckRunConclusion {
-	return NilCheckRunConclusion{
-		Value: v,
-	}
-}
-
-// NilCheckRunConclusion is nullable CheckRunConclusion.
-type NilCheckRunConclusion struct {
-	Value CheckRunConclusion
-	Null  bool
-}
-
-// SetTo sets value to v.
-func (o *NilCheckRunConclusion) SetTo(v CheckRunConclusion) {
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o NilCheckRunConclusion) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o NilCheckRunConclusion) Get() (v CheckRunConclusion, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o NilCheckRunConclusion) Or(d CheckRunConclusion) CheckRunConclusion {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
-// NewNilCheckSuiteConclusion returns new NilCheckSuiteConclusion with value set to v.
-func NewNilCheckSuiteConclusion(v CheckSuiteConclusion) NilCheckSuiteConclusion {
-	return NilCheckSuiteConclusion{
-		Value: v,
-	}
-}
-
-// NilCheckSuiteConclusion is nullable CheckSuiteConclusion.
-type NilCheckSuiteConclusion struct {
-	Value CheckSuiteConclusion
-	Null  bool
-}
-
-// SetTo sets value to v.
-func (o *NilCheckSuiteConclusion) SetTo(v CheckSuiteConclusion) {
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o NilCheckSuiteConclusion) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o NilCheckSuiteConclusion) Get() (v CheckSuiteConclusion, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o NilCheckSuiteConclusion) Or(d CheckSuiteConclusion) CheckSuiteConclusion {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
-// NewNilCheckSuiteStatus returns new NilCheckSuiteStatus with value set to v.
-func NewNilCheckSuiteStatus(v CheckSuiteStatus) NilCheckSuiteStatus {
-	return NilCheckSuiteStatus{
-		Value: v,
-	}
-}
-
-// NilCheckSuiteStatus is nullable CheckSuiteStatus.
-type NilCheckSuiteStatus struct {
-	Value CheckSuiteStatus
-	Null  bool
-}
-
-// SetTo sets value to v.
-func (o *NilCheckSuiteStatus) SetTo(v CheckSuiteStatus) {
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o NilCheckSuiteStatus) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o NilCheckSuiteStatus) Get() (v CheckSuiteStatus, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o NilCheckSuiteStatus) Or(d CheckSuiteStatus) CheckSuiteStatus {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
 // NewNilCodeScanningAlertDismissedAt returns new NilCodeScanningAlertDismissedAt with value set to v.
 func NewNilCodeScanningAlertDismissedAt(v CodeScanningAlertDismissedAt) NilCodeScanningAlertDismissedAt {
 	return NilCodeScanningAlertDismissedAt{
@@ -7615,44 +7501,6 @@ func (o NilNullableTeamSimple) Or(d NullableTeamSimple) NullableTeamSimple {
 	return d
 }
 
-// NewNilPageStatus returns new NilPageStatus with value set to v.
-func NewNilPageStatus(v PageStatus) NilPageStatus {
-	return NilPageStatus{
-		Value: v,
-	}
-}
-
-// NilPageStatus is nullable PageStatus.
-type NilPageStatus struct {
-	Value PageStatus
-	Null  bool
-}
-
-// SetTo sets value to v.
-func (o *NilPageStatus) SetTo(v PageStatus) {
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o NilPageStatus) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o NilPageStatus) Get() (v PageStatus, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o NilPageStatus) Or(d PageStatus) PageStatus {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
 // NewNilPullRequestHeadRepo returns new NilPullRequestHeadRepo with value set to v.
 func NewNilPullRequestHeadRepo(v PullRequestHeadRepo) NilPullRequestHeadRepo {
 	return NilPullRequestHeadRepo{
@@ -12453,6 +12301,144 @@ func (o OptCodeScanningAlertLocation) Or(d CodeScanningAlertLocation) CodeScanni
 	return d
 }
 
+// NewOptCodeScanningAlertRuleSecuritySeverityLevel returns new OptCodeScanningAlertRuleSecuritySeverityLevel with value set to v.
+func NewOptCodeScanningAlertRuleSecuritySeverityLevel(v CodeScanningAlertRuleSecuritySeverityLevel) OptCodeScanningAlertRuleSecuritySeverityLevel {
+	return OptCodeScanningAlertRuleSecuritySeverityLevel{
+		Value: v,
+		Set:   true,
+	}
+}
+
+// OptCodeScanningAlertRuleSecuritySeverityLevel is optional CodeScanningAlertRuleSecuritySeverityLevel.
+type OptCodeScanningAlertRuleSecuritySeverityLevel struct {
+	Value CodeScanningAlertRuleSecuritySeverityLevel
+	Set   bool
+}
+
+// IsSet returns true if OptCodeScanningAlertRuleSecuritySeverityLevel was set.
+func (o OptCodeScanningAlertRuleSecuritySeverityLevel) IsSet() bool { return o.Set }
+
+// Reset unsets value.
+func (o *OptCodeScanningAlertRuleSecuritySeverityLevel) Reset() {
+	var v CodeScanningAlertRuleSecuritySeverityLevel
+	o.Value = v
+	o.Set = false
+}
+
+// SetTo sets value to v.
+func (o *OptCodeScanningAlertRuleSecuritySeverityLevel) SetTo(v CodeScanningAlertRuleSecuritySeverityLevel) {
+	o.Set = true
+	o.Value = v
+}
+
+// Get returns value and boolean that denotes whether value was set.
+func (o OptCodeScanningAlertRuleSecuritySeverityLevel) Get() (v CodeScanningAlertRuleSecuritySeverityLevel, ok bool) {
+	if !o.Set {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o OptCodeScanningAlertRuleSecuritySeverityLevel) Or(d CodeScanningAlertRuleSecuritySeverityLevel) CodeScanningAlertRuleSecuritySeverityLevel {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
+// NewOptCodeScanningAlertRuleSeverity returns new OptCodeScanningAlertRuleSeverity with value set to v.
+func NewOptCodeScanningAlertRuleSeverity(v CodeScanningAlertRuleSeverity) OptCodeScanningAlertRuleSeverity {
+	return OptCodeScanningAlertRuleSeverity{
+		Value: v,
+		Set:   true,
+	}
+}
+
+// OptCodeScanningAlertRuleSeverity is optional CodeScanningAlertRuleSeverity.
+type OptCodeScanningAlertRuleSeverity struct {
+	Value CodeScanningAlertRuleSeverity
+	Set   bool
+}
+
+// IsSet returns true if OptCodeScanningAlertRuleSeverity was set.
+func (o OptCodeScanningAlertRuleSeverity) IsSet() bool { return o.Set }
+
+// Reset unsets value.
+func (o *OptCodeScanningAlertRuleSeverity) Reset() {
+	var v CodeScanningAlertRuleSeverity
+	o.Value = v
+	o.Set = false
+}
+
+// SetTo sets value to v.
+func (o *OptCodeScanningAlertRuleSeverity) SetTo(v CodeScanningAlertRuleSeverity) {
+	o.Set = true
+	o.Value = v
+}
+
+// Get returns value and boolean that denotes whether value was set.
+func (o OptCodeScanningAlertRuleSeverity) Get() (v CodeScanningAlertRuleSeverity, ok bool) {
+	if !o.Set {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o OptCodeScanningAlertRuleSeverity) Or(d CodeScanningAlertRuleSeverity) CodeScanningAlertRuleSeverity {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
+// NewOptCodeScanningAlertRuleSummarySeverity returns new OptCodeScanningAlertRuleSummarySeverity with value set to v.
+func NewOptCodeScanningAlertRuleSummarySeverity(v CodeScanningAlertRuleSummarySeverity) OptCodeScanningAlertRuleSummarySeverity {
+	return OptCodeScanningAlertRuleSummarySeverity{
+		Value: v,
+		Set:   true,
+	}
+}
+
+// OptCodeScanningAlertRuleSummarySeverity is optional CodeScanningAlertRuleSummarySeverity.
+type OptCodeScanningAlertRuleSummarySeverity struct {
+	Value CodeScanningAlertRuleSummarySeverity
+	Set   bool
+}
+
+// IsSet returns true if OptCodeScanningAlertRuleSummarySeverity was set.
+func (o OptCodeScanningAlertRuleSummarySeverity) IsSet() bool { return o.Set }
+
+// Reset unsets value.
+func (o *OptCodeScanningAlertRuleSummarySeverity) Reset() {
+	var v CodeScanningAlertRuleSummarySeverity
+	o.Value = v
+	o.Set = false
+}
+
+// SetTo sets value to v.
+func (o *OptCodeScanningAlertRuleSummarySeverity) SetTo(v CodeScanningAlertRuleSummarySeverity) {
+	o.Set = true
+	o.Value = v
+}
+
+// Get returns value and boolean that denotes whether value was set.
+func (o OptCodeScanningAlertRuleSummarySeverity) Get() (v CodeScanningAlertRuleSummarySeverity, ok bool) {
+	if !o.Set {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o OptCodeScanningAlertRuleSummarySeverity) Or(d CodeScanningAlertRuleSummarySeverity) CodeScanningAlertRuleSummarySeverity {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
 // NewOptCodeScanningAlertState returns new OptCodeScanningAlertState with value set to v.
 func NewOptCodeScanningAlertState(v CodeScanningAlertState) OptCodeScanningAlertState {
 	return OptCodeScanningAlertState{
@@ -16663,171 +16649,6 @@ func (o OptNilCodeScanningAlertDismissedReason) Or(d CodeScanningAlertDismissedR
 	return d
 }
 
-// NewOptNilCodeScanningAlertRuleSecuritySeverityLevel returns new OptNilCodeScanningAlertRuleSecuritySeverityLevel with value set to v.
-func NewOptNilCodeScanningAlertRuleSecuritySeverityLevel(v CodeScanningAlertRuleSecuritySeverityLevel) OptNilCodeScanningAlertRuleSecuritySeverityLevel {
-	return OptNilCodeScanningAlertRuleSecuritySeverityLevel{
-		Value: v,
-		Set:   true,
-	}
-}
-
-// OptNilCodeScanningAlertRuleSecuritySeverityLevel is optional nullable CodeScanningAlertRuleSecuritySeverityLevel.
-type OptNilCodeScanningAlertRuleSecuritySeverityLevel struct {
-	Value CodeScanningAlertRuleSecuritySeverityLevel
-	Set   bool
-	Null  bool
-}
-
-// IsSet returns true if OptNilCodeScanningAlertRuleSecuritySeverityLevel was set.
-func (o OptNilCodeScanningAlertRuleSecuritySeverityLevel) IsSet() bool { return o.Set }
-
-// Reset unsets value.
-func (o *OptNilCodeScanningAlertRuleSecuritySeverityLevel) Reset() {
-	var v CodeScanningAlertRuleSecuritySeverityLevel
-	o.Value = v
-	o.Set = false
-	o.Null = false
-}
-
-// SetTo sets value to v.
-func (o *OptNilCodeScanningAlertRuleSecuritySeverityLevel) SetTo(v CodeScanningAlertRuleSecuritySeverityLevel) {
-	o.Set = true
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o OptNilCodeScanningAlertRuleSecuritySeverityLevel) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o OptNilCodeScanningAlertRuleSecuritySeverityLevel) Get() (v CodeScanningAlertRuleSecuritySeverityLevel, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	if !o.Set {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o OptNilCodeScanningAlertRuleSecuritySeverityLevel) Or(d CodeScanningAlertRuleSecuritySeverityLevel) CodeScanningAlertRuleSecuritySeverityLevel {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
-// NewOptNilCodeScanningAlertRuleSeverity returns new OptNilCodeScanningAlertRuleSeverity with value set to v.
-func NewOptNilCodeScanningAlertRuleSeverity(v CodeScanningAlertRuleSeverity) OptNilCodeScanningAlertRuleSeverity {
-	return OptNilCodeScanningAlertRuleSeverity{
-		Value: v,
-		Set:   true,
-	}
-}
-
-// OptNilCodeScanningAlertRuleSeverity is optional nullable CodeScanningAlertRuleSeverity.
-type OptNilCodeScanningAlertRuleSeverity struct {
-	Value CodeScanningAlertRuleSeverity
-	Set   bool
-	Null  bool
-}
-
-// IsSet returns true if OptNilCodeScanningAlertRuleSeverity was set.
-func (o OptNilCodeScanningAlertRuleSeverity) IsSet() bool { return o.Set }
-
-// Reset unsets value.
-func (o *OptNilCodeScanningAlertRuleSeverity) Reset() {
-	var v CodeScanningAlertRuleSeverity
-	o.Value = v
-	o.Set = false
-	o.Null = false
-}
-
-// SetTo sets value to v.
-func (o *OptNilCodeScanningAlertRuleSeverity) SetTo(v CodeScanningAlertRuleSeverity) {
-	o.Set = true
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o OptNilCodeScanningAlertRuleSeverity) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o OptNilCodeScanningAlertRuleSeverity) Get() (v CodeScanningAlertRuleSeverity, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	if !o.Set {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o OptNilCodeScanningAlertRuleSeverity) Or(d CodeScanningAlertRuleSeverity) CodeScanningAlertRuleSeverity {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
-// NewOptNilCodeScanningAlertRuleSummarySeverity returns new OptNilCodeScanningAlertRuleSummarySeverity with value set to v.
-func NewOptNilCodeScanningAlertRuleSummarySeverity(v CodeScanningAlertRuleSummarySeverity) OptNilCodeScanningAlertRuleSummarySeverity {
-	return OptNilCodeScanningAlertRuleSummarySeverity{
-		Value: v,
-		Set:   true,
-	}
-}
-
-// OptNilCodeScanningAlertRuleSummarySeverity is optional nullable CodeScanningAlertRuleSummarySeverity.
-type OptNilCodeScanningAlertRuleSummarySeverity struct {
-	Value CodeScanningAlertRuleSummarySeverity
-	Set   bool
-	Null  bool
-}
-
-// IsSet returns true if OptNilCodeScanningAlertRuleSummarySeverity was set.
-func (o OptNilCodeScanningAlertRuleSummarySeverity) IsSet() bool { return o.Set }
-
-// Reset unsets value.
-func (o *OptNilCodeScanningAlertRuleSummarySeverity) Reset() {
-	var v CodeScanningAlertRuleSummarySeverity
-	o.Value = v
-	o.Set = false
-	o.Null = false
-}
-
-// SetTo sets value to v.
-func (o *OptNilCodeScanningAlertRuleSummarySeverity) SetTo(v CodeScanningAlertRuleSummarySeverity) {
-	o.Set = true
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o OptNilCodeScanningAlertRuleSummarySeverity) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o OptNilCodeScanningAlertRuleSummarySeverity) Get() (v CodeScanningAlertRuleSummarySeverity, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	if !o.Set {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o OptNilCodeScanningAlertRuleSummarySeverity) Or(d CodeScanningAlertRuleSummarySeverity) CodeScanningAlertRuleSummarySeverity {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
 // NewOptNilCodeScanningAnalysisToolGUID returns new OptNilCodeScanningAnalysisToolGUID with value set to v.
 func NewOptNilCodeScanningAnalysisToolGUID(v CodeScanningAnalysisToolGUID) OptNilCodeScanningAnalysisToolGUID {
 	return OptNilCodeScanningAnalysisToolGUID{
@@ -17983,61 +17804,6 @@ func (o OptNilNullableTeamSimple) Or(d NullableTeamSimple) NullableTeamSimple {
 	return d
 }
 
-// NewOptNilPageProtectedDomainState returns new OptNilPageProtectedDomainState with value set to v.
-func NewOptNilPageProtectedDomainState(v PageProtectedDomainState) OptNilPageProtectedDomainState {
-	return OptNilPageProtectedDomainState{
-		Value: v,
-		Set:   true,
-	}
-}
-
-// OptNilPageProtectedDomainState is optional nullable PageProtectedDomainState.
-type OptNilPageProtectedDomainState struct {
-	Value PageProtectedDomainState
-	Set   bool
-	Null  bool
-}
-
-// IsSet returns true if OptNilPageProtectedDomainState was set.
-func (o OptNilPageProtectedDomainState) IsSet() bool { return o.Set }
-
-// Reset unsets value.
-func (o *OptNilPageProtectedDomainState) Reset() {
-	var v PageProtectedDomainState
-	o.Value = v
-	o.Set = false
-	o.Null = false
-}
-
-// SetTo sets value to v.
-func (o *OptNilPageProtectedDomainState) SetTo(v PageProtectedDomainState) {
-	o.Set = true
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o OptNilPageProtectedDomainState) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o OptNilPageProtectedDomainState) Get() (v PageProtectedDomainState, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	if !o.Set {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o OptNilPageProtectedDomainState) Or(d PageProtectedDomainState) PageProtectedDomainState {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
 // NewOptNilPagesHealthCheckAltDomain returns new OptNilPagesHealthCheckAltDomain with value set to v.
 func NewOptNilPagesHealthCheckAltDomain(v PagesHealthCheckAltDomain) OptNilPagesHealthCheckAltDomain {
 	return OptNilPagesHealthCheckAltDomain{
@@ -18093,61 +17859,6 @@ func (o OptNilPagesHealthCheckAltDomain) Or(d PagesHealthCheckAltDomain) PagesHe
 	return d
 }
 
-// NewOptNilPullRequestReviewCommentStartSide returns new OptNilPullRequestReviewCommentStartSide with value set to v.
-func NewOptNilPullRequestReviewCommentStartSide(v PullRequestReviewCommentStartSide) OptNilPullRequestReviewCommentStartSide {
-	return OptNilPullRequestReviewCommentStartSide{
-		Value: v,
-		Set:   true,
-	}
-}
-
-// OptNilPullRequestReviewCommentStartSide is optional nullable PullRequestReviewCommentStartSide.
-type OptNilPullRequestReviewCommentStartSide struct {
-	Value PullRequestReviewCommentStartSide
-	Set   bool
-	Null  bool
-}
-
-// IsSet returns true if OptNilPullRequestReviewCommentStartSide was set.
-func (o OptNilPullRequestReviewCommentStartSide) IsSet() bool { return o.Set }
-
-// Reset unsets value.
-func (o *OptNilPullRequestReviewCommentStartSide) Reset() {
-	var v PullRequestReviewCommentStartSide
-	o.Value = v
-	o.Set = false
-	o.Null = false
-}
-
-// SetTo sets value to v.
-func (o *OptNilPullRequestReviewCommentStartSide) SetTo(v PullRequestReviewCommentStartSide) {
-	o.Set = true
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o OptNilPullRequestReviewCommentStartSide) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o OptNilPullRequestReviewCommentStartSide) Get() (v PullRequestReviewCommentStartSide, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	if !o.Set {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o OptNilPullRequestReviewCommentStartSide) Or(d PullRequestReviewCommentStartSide) PullRequestReviewCommentStartSide {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
 // NewOptNilReposCreateOrUpdateEnvironmentReqReviewersItemArray returns new OptNilReposCreateOrUpdateEnvironmentReqReviewersItemArray with value set to v.
 func NewOptNilReposCreateOrUpdateEnvironmentReqReviewersItemArray(v []ReposCreateOrUpdateEnvironmentReqReviewersItem) OptNilReposCreateOrUpdateEnvironmentReqReviewersItemArray {
 	return OptNilReposCreateOrUpdateEnvironmentReqReviewersItemArray{
@@ -18313,61 +18024,6 @@ func (o OptNilRepositoryTemplateRepository) Or(d RepositoryTemplateRepository) R
 	return d
 }
 
-// NewOptNilReviewCommentStartSide returns new OptNilReviewCommentStartSide with value set to v.
-func NewOptNilReviewCommentStartSide(v ReviewCommentStartSide) OptNilReviewCommentStartSide {
-	return OptNilReviewCommentStartSide{
-		Value: v,
-		Set:   true,
-	}
-}
-
-// OptNilReviewCommentStartSide is optional nullable ReviewCommentStartSide.
-type OptNilReviewCommentStartSide struct {
-	Value ReviewCommentStartSide
-	Set   bool
-	Null  bool
-}
-
-// IsSet returns true if OptNilReviewCommentStartSide was set.
-func (o OptNilReviewCommentStartSide) IsSet() bool { return o.Set }
-
-// Reset unsets value.
-func (o *OptNilReviewCommentStartSide) Reset() {
-	var v ReviewCommentStartSide
-	o.Value = v
-	o.Set = false
-	o.Null = false
-}
-
-// SetTo sets value to v.
-func (o *OptNilReviewCommentStartSide) SetTo(v ReviewCommentStartSide) {
-	o.Set = true
-	o.Null = false
-	o.Value = v
-}
-
-// IsSet returns true if value is Null.
-func (o OptNilReviewCommentStartSide) IsNull() bool { return o.Null }
-
-// Get returns value and boolean that denotes whether value was set.
-func (o OptNilReviewCommentStartSide) Get() (v ReviewCommentStartSide, ok bool) {
-	if o.Null {
-		return v, false
-	}
-	if !o.Set {
-		return v, false
-	}
-	return o.Value, true
-}
-
-// Or returns value if set, or given parameter if does not.
-func (o OptNilReviewCommentStartSide) Or(d ReviewCommentStartSide) ReviewCommentStartSide {
-	if v, ok := o.Get(); ok {
-		return v
-	}
-	return d
-}
-
 // NewOptNilSecretScanningAlertResolution returns new OptNilSecretScanningAlertResolution with value set to v.
 func NewOptNilSecretScanningAlertResolution(v SecretScanningAlertResolution) OptNilSecretScanningAlertResolution {
 	return OptNilSecretScanningAlertResolution{
@@ -20392,6 +20048,52 @@ func (o OptPackagesListPackagesForUserVisibility) Or(d PackagesListPackagesForUs
 	return d
 }
 
+// NewOptPageProtectedDomainState returns new OptPageProtectedDomainState with value set to v.
+func NewOptPageProtectedDomainState(v PageProtectedDomainState) OptPageProtectedDomainState {
+	return OptPageProtectedDomainState{
+		Value: v,
+		Set:   true,
+	}
+}
+
+// OptPageProtectedDomainState is optional PageProtectedDomainState.
+type OptPageProtectedDomainState struct {
+	Value PageProtectedDomainState
+	Set   bool
+}
+
+// IsSet returns true if OptPageProtectedDomainState was set.
+func (o OptPageProtectedDomainState) IsSet() bool { return o.Set }
+
+// Reset unsets value.
+func (o *OptPageProtectedDomainState) Reset() {
+	var v PageProtectedDomainState
+	o.Value = v
+	o.Set = false
+}
+
+// SetTo sets value to v.
+func (o *OptPageProtectedDomainState) SetTo(v PageProtectedDomainState) {
+	o.Set = true
+	o.Value = v
+}
+
+// Get returns value and boolean that denotes whether value was set.
+func (o OptPageProtectedDomainState) Get() (v PageProtectedDomainState, ok bool) {
+	if !o.Set {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o OptPageProtectedDomainState) Or(d PageProtectedDomainState) PageProtectedDomainState {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
 // NewOptPagesHTTPSCertificate returns new OptPagesHTTPSCertificate with value set to v.
 func NewOptPagesHTTPSCertificate(v PagesHTTPSCertificate) OptPagesHTTPSCertificate {
 	return OptPagesHTTPSCertificate{
@@ -21818,6 +21520,52 @@ func (o OptPullRequestReviewCommentSide) Or(d PullRequestReviewCommentSide) Pull
 	return d
 }
 
+// NewOptPullRequestReviewCommentStartSide returns new OptPullRequestReviewCommentStartSide with value set to v.
+func NewOptPullRequestReviewCommentStartSide(v PullRequestReviewCommentStartSide) OptPullRequestReviewCommentStartSide {
+	return OptPullRequestReviewCommentStartSide{
+		Value: v,
+		Set:   true,
+	}
+}
+
+// OptPullRequestReviewCommentStartSide is optional PullRequestReviewCommentStartSide.
+type OptPullRequestReviewCommentStartSide struct {
+	Value PullRequestReviewCommentStartSide
+	Set   bool
+}
+
+// IsSet returns true if OptPullRequestReviewCommentStartSide was set.
+func (o OptPullRequestReviewCommentStartSide) IsSet() bool { return o.Set }
+
+// Reset unsets value.
+func (o *OptPullRequestReviewCommentStartSide) Reset() {
+	var v PullRequestReviewCommentStartSide
+	o.Value = v
+	o.Set = false
+}
+
+// SetTo sets value to v.
+func (o *OptPullRequestReviewCommentStartSide) SetTo(v PullRequestReviewCommentStartSide) {
+	o.Set = true
+	o.Value = v
+}
+
+// Get returns value and boolean that denotes whether value was set.
+func (o OptPullRequestReviewCommentStartSide) Get() (v PullRequestReviewCommentStartSide, ok bool) {
+	if !o.Set {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o OptPullRequestReviewCommentStartSide) Or(d PullRequestReviewCommentStartSide) PullRequestReviewCommentStartSide {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
 // NewOptPullsCreateReviewCommentReqSide returns new OptPullsCreateReviewCommentReqSide with value set to v.
 func NewOptPullsCreateReviewCommentReqSide(v PullsCreateReviewCommentReqSide) OptPullsCreateReviewCommentReqSide {
 	return OptPullsCreateReviewCommentReqSide{
@@ -25868,6 +25616,52 @@ func (o OptReviewCommentSide) Or(d ReviewCommentSide) ReviewCommentSide {
 	return d
 }
 
+// NewOptReviewCommentStartSide returns new OptReviewCommentStartSide with value set to v.
+func NewOptReviewCommentStartSide(v ReviewCommentStartSide) OptReviewCommentStartSide {
+	return OptReviewCommentStartSide{
+		Value: v,
+		Set:   true,
+	}
+}
+
+// OptReviewCommentStartSide is optional ReviewCommentStartSide.
+type OptReviewCommentStartSide struct {
+	Value ReviewCommentStartSide
+	Set   bool
+}
+
+// IsSet returns true if OptReviewCommentStartSide was set.
+func (o OptReviewCommentStartSide) IsSet() bool { return o.Set }
+
+// Reset unsets value.
+func (o *OptReviewCommentStartSide) Reset() {
+	var v ReviewCommentStartSide
+	o.Value = v
+	o.Set = false
+}
+
+// SetTo sets value to v.
+func (o *OptReviewCommentStartSide) SetTo(v ReviewCommentStartSide) {
+	o.Set = true
+	o.Value = v
+}
+
+// Get returns value and boolean that denotes whether value was set.
+func (o OptReviewCommentStartSide) Get() (v ReviewCommentStartSide, ok bool) {
+	if !o.Set {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o OptReviewCommentStartSide) Or(d ReviewCommentStartSide) ReviewCommentStartSide {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
 // NewOptRunnerLabelsItemType returns new OptRunnerLabelsItemType with value set to v.
 func NewOptRunnerLabelsItemType(v RunnerLabelsItemType) OptRunnerLabelsItemType {
 	return OptRunnerLabelsItemType{
@@ -30659,17 +30453,17 @@ const (
 
 // Ref: #/components/schemas/page
 type Page struct {
-	URL                       url.URL                        `json:"url"`
-	Status                    NilPageStatus                  `json:"status"`
-	Cname                     NilString                      `json:"cname"`
-	ProtectedDomainState      OptNilPageProtectedDomainState `json:"protected_domain_state"`
-	PendingDomainUnverifiedAt OptNilTime                     `json:"pending_domain_unverified_at"`
-	Custom404                 bool                           `json:"custom_404"`
-	HTMLURL                   OptURL                         `json:"html_url"`
-	Source                    OptPagesSourceHash             `json:"source"`
-	Public                    bool                           `json:"public"`
-	HTTPSCertificate          OptPagesHTTPSCertificate       `json:"https_certificate"`
-	HTTPSEnforced             OptBool                        `json:"https_enforced"`
+	URL                       url.URL                     `json:"url"`
+	Status                    PageStatus                  `json:"status"`
+	Cname                     NilString                   `json:"cname"`
+	ProtectedDomainState      OptPageProtectedDomainState `json:"protected_domain_state"`
+	PendingDomainUnverifiedAt OptNilTime                  `json:"pending_domain_unverified_at"`
+	Custom404                 bool                        `json:"custom_404"`
+	HTMLURL                   OptURL                      `json:"html_url"`
+	Source                    OptPagesSourceHash          `json:"source"`
+	Public                    bool                        `json:"public"`
+	HTTPSCertificate          OptPagesHTTPSCertificate    `json:"https_certificate"`
+	HTTPSEnforced             OptBool                     `json:"https_enforced"`
 }
 
 func (*Page) reposCreatePagesSiteRes() {}
@@ -32097,34 +31891,34 @@ func (*PullRequestReview) pullsUpdateReviewRes()        {}
 
 // Ref: #/components/schemas/pull-request-review-comment
 type PullRequestReviewComment struct {
-	URL                 string                                  `json:"url"`
-	PullRequestReviewID NilInt                                  `json:"pull_request_review_id"`
-	ID                  int                                     `json:"id"`
-	NodeID              string                                  `json:"node_id"`
-	DiffHunk            string                                  `json:"diff_hunk"`
-	Path                string                                  `json:"path"`
-	Position            int                                     `json:"position"`
-	OriginalPosition    int                                     `json:"original_position"`
-	CommitID            string                                  `json:"commit_id"`
-	OriginalCommitID    string                                  `json:"original_commit_id"`
-	InReplyToID         OptInt                                  `json:"in_reply_to_id"`
-	User                SimpleUser                              `json:"user"`
-	Body                string                                  `json:"body"`
-	CreatedAt           time.Time                               `json:"created_at"`
-	UpdatedAt           time.Time                               `json:"updated_at"`
-	HTMLURL             url.URL                                 `json:"html_url"`
-	PullRequestURL      url.URL                                 `json:"pull_request_url"`
-	AuthorAssociation   AuthorAssociation                       `json:"author_association"`
-	Links               PullRequestReviewCommentLinks           `json:"_links"`
-	StartLine           OptNilInt                               `json:"start_line"`
-	OriginalStartLine   OptNilInt                               `json:"original_start_line"`
-	StartSide           OptNilPullRequestReviewCommentStartSide `json:"start_side"`
-	Line                OptInt                                  `json:"line"`
-	OriginalLine        OptInt                                  `json:"original_line"`
-	Side                OptPullRequestReviewCommentSide         `json:"side"`
-	Reactions           OptReactionRollup                       `json:"reactions"`
-	BodyHTML            OptString                               `json:"body_html"`
-	BodyText            OptString                               `json:"body_text"`
+	URL                 string                               `json:"url"`
+	PullRequestReviewID NilInt                               `json:"pull_request_review_id"`
+	ID                  int                                  `json:"id"`
+	NodeID              string                               `json:"node_id"`
+	DiffHunk            string                               `json:"diff_hunk"`
+	Path                string                               `json:"path"`
+	Position            int                                  `json:"position"`
+	OriginalPosition    int                                  `json:"original_position"`
+	CommitID            string                               `json:"commit_id"`
+	OriginalCommitID    string                               `json:"original_commit_id"`
+	InReplyToID         OptInt                               `json:"in_reply_to_id"`
+	User                SimpleUser                           `json:"user"`
+	Body                string                               `json:"body"`
+	CreatedAt           time.Time                            `json:"created_at"`
+	UpdatedAt           time.Time                            `json:"updated_at"`
+	HTMLURL             url.URL                              `json:"html_url"`
+	PullRequestURL      url.URL                              `json:"pull_request_url"`
+	AuthorAssociation   AuthorAssociation                    `json:"author_association"`
+	Links               PullRequestReviewCommentLinks        `json:"_links"`
+	StartLine           OptNilInt                            `json:"start_line"`
+	OriginalStartLine   OptNilInt                            `json:"original_start_line"`
+	StartSide           OptPullRequestReviewCommentStartSide `json:"start_side"`
+	Line                OptInt                               `json:"line"`
+	OriginalLine        OptInt                               `json:"original_line"`
+	Side                OptPullRequestReviewCommentSide      `json:"side"`
+	Reactions           OptReactionRollup                    `json:"reactions"`
+	BodyHTML            OptString                            `json:"body_html"`
+	BodyText            OptString                            `json:"body_text"`
 }
 
 func (*PullRequestReviewComment) pullsCreateReplyForReviewCommentRes() {}
@@ -35443,34 +35237,34 @@ type RepositoryTemplateRepositoryPermissions struct {
 
 // Ref: #/components/schemas/review-comment
 type ReviewComment struct {
-	URL                 url.URL                      `json:"url"`
-	PullRequestReviewID NilInt                       `json:"pull_request_review_id"`
-	ID                  int                          `json:"id"`
-	NodeID              string                       `json:"node_id"`
-	DiffHunk            string                       `json:"diff_hunk"`
-	Path                string                       `json:"path"`
-	Position            NilInt                       `json:"position"`
-	OriginalPosition    int                          `json:"original_position"`
-	CommitID            string                       `json:"commit_id"`
-	OriginalCommitID    string                       `json:"original_commit_id"`
-	InReplyToID         OptInt                       `json:"in_reply_to_id"`
-	User                NilNullableSimpleUser        `json:"user"`
-	Body                string                       `json:"body"`
-	CreatedAt           time.Time                    `json:"created_at"`
-	UpdatedAt           time.Time                    `json:"updated_at"`
-	HTMLURL             url.URL                      `json:"html_url"`
-	PullRequestURL      url.URL                      `json:"pull_request_url"`
-	AuthorAssociation   AuthorAssociation            `json:"author_association"`
-	Links               ReviewCommentLinks           `json:"_links"`
-	BodyText            OptString                    `json:"body_text"`
-	BodyHTML            OptString                    `json:"body_html"`
-	Reactions           OptReactionRollup            `json:"reactions"`
-	Side                OptReviewCommentSide         `json:"side"`
-	StartSide           OptNilReviewCommentStartSide `json:"start_side"`
-	Line                OptInt                       `json:"line"`
-	OriginalLine        OptInt                       `json:"original_line"`
-	StartLine           OptNilInt                    `json:"start_line"`
-	OriginalStartLine   OptNilInt                    `json:"original_start_line"`
+	URL                 url.URL                   `json:"url"`
+	PullRequestReviewID NilInt                    `json:"pull_request_review_id"`
+	ID                  int                       `json:"id"`
+	NodeID              string                    `json:"node_id"`
+	DiffHunk            string                    `json:"diff_hunk"`
+	Path                string                    `json:"path"`
+	Position            NilInt                    `json:"position"`
+	OriginalPosition    int                       `json:"original_position"`
+	CommitID            string                    `json:"commit_id"`
+	OriginalCommitID    string                    `json:"original_commit_id"`
+	InReplyToID         OptInt                    `json:"in_reply_to_id"`
+	User                NilNullableSimpleUser     `json:"user"`
+	Body                string                    `json:"body"`
+	CreatedAt           time.Time                 `json:"created_at"`
+	UpdatedAt           time.Time                 `json:"updated_at"`
+	HTMLURL             url.URL                   `json:"html_url"`
+	PullRequestURL      url.URL                   `json:"pull_request_url"`
+	AuthorAssociation   AuthorAssociation         `json:"author_association"`
+	Links               ReviewCommentLinks        `json:"_links"`
+	BodyText            OptString                 `json:"body_text"`
+	BodyHTML            OptString                 `json:"body_html"`
+	Reactions           OptReactionRollup         `json:"reactions"`
+	Side                OptReviewCommentSide      `json:"side"`
+	StartSide           OptReviewCommentStartSide `json:"start_side"`
+	Line                OptInt                    `json:"line"`
+	OriginalLine        OptInt                    `json:"original_line"`
+	StartLine           OptNilInt                 `json:"start_line"`
+	OriginalStartLine   OptNilInt                 `json:"original_start_line"`
 }
 
 type ReviewCommentLinks struct {
diff --git a/examples/ex_github/oas_validators_gen.go b/examples/ex_github/oas_validators_gen.go
index 0c2a2dca..e8379d41 100644
--- a/examples/ex_github/oas_validators_gen.go
+++ b/examples/ex_github/oas_validators_gen.go
@@ -2683,11 +2683,10 @@ func (s CheckRun) Validate() error {
 		})
 	}
 	if err := func() error {
-		if err := s.Conclusion.Value.Validate(); err != nil {
+		if err := s.Conclusion.Validate(); err != nil {
 			return err
 		}
 		return nil
-		return nil
 	}(); err != nil {
 		failures = append(failures, validate.FieldError{
 			Name:  "conclusion",
@@ -2765,11 +2764,10 @@ func (s CheckRunStatus) Validate() error {
 func (s CheckSuite) Validate() error {
 	var failures []validate.FieldError
 	if err := func() error {
-		if err := s.Status.Value.Validate(); err != nil {
+		if err := s.Status.Validate(); err != nil {
 			return err
 		}
 		return nil
-		return nil
 	}(); err != nil {
 		failures = append(failures, validate.FieldError{
 			Name:  "status",
@@ -2777,11 +2775,10 @@ func (s CheckSuite) Validate() error {
 		})
 	}
 	if err := func() error {
-		if err := s.Conclusion.Value.Validate(); err != nil {
+		if err := s.Conclusion.Validate(); err != nil {
 			return err
 		}
 		return nil
-		return nil
 	}(); err != nil {
 		failures = append(failures, validate.FieldError{
 			Name:  "conclusion",
@@ -9303,11 +9300,10 @@ func (s PackagesRestorePackageVersionForUserPackageType) Validate() error {
 func (s Page) Validate() error {
 	var failures []validate.FieldError
 	if err := func() error {
-		if err := s.Status.Value.Validate(); err != nil {
+		if err := s.Status.Validate(); err != nil {
 			return err
 		}
 		return nil
-		return nil
 	}(); err != nil {
 		failures = append(failures, validate.FieldError{
 			Name:  "status",
diff --git a/internal/oas/parser/schema_parser.go b/internal/oas/parser/schema_parser.go
index 20936435..020fa1c8 100644
--- a/internal/oas/parser/schema_parser.go
+++ b/internal/oas/parser/schema_parser.go
@@ -225,7 +225,33 @@ func (p *schemaParser) resolve(ref string) (*oas.Schema, error) {
 
 func (p *schemaParser) extendInfo(schema *ogen.Schema, s *oas.Schema) *oas.Schema {
 	s.Description = schema.Description
-	s.Nullable = schema.Nullable
+	// Workaround: handle nullable enums correctly.
+	//
+	// Notice that nullable enum requires `null` in value list.
+	//
+	// See https://github.com/OAI/OpenAPI-Specification/blob/main/proposals/2019-10-31-Clarify-Nullable.md#if-a-schema-specifies-nullable-true-and-enum-1-2-3-does-that-schema-allow-null-values-see-1900.
+	if len(s.Enum) < 1 {
+		s.Nullable = schema.Nullable
+	} else {
+		// Check that enum contains `null` value.
+		for _, v := range s.Enum {
+			if v == nil {
+				s.Nullable = true
+				break
+			}
+		}
+		// Filter all `null`s.
+		if s.Nullable {
+			n := 0
+			for _, v := range s.Enum {
+				if v != nil {
+					s.Enum[n] = v
+					n++
+				}
+			}
+			s.Enum = s.Enum[:n]
+		}
+	}
 	if d := schema.Discriminator; d != nil {
 		s.Discriminator = &oas.Discriminator{
 			PropertyName: d.PropertyName,
diff --git a/internal/oas/parser/schema_parser_enum.go b/internal/oas/parser/schema_parser_enum.go
index 435d2a1d..43db0c53 100644
--- a/internal/oas/parser/schema_parser_enum.go
+++ b/internal/oas/parser/schema_parser_enum.go
@@ -14,10 +14,12 @@ func parseEnumValues(typ oas.SchemaType, rawValues []json.RawMessage) ([]interfa
 		values []interface{}
 		unique = map[interface{}]struct{}{}
 	)
+	nullable := false
 	for _, raw := range rawValues {
 		val, err := parseJSONValue(typ, raw)
 		if err != nil {
 			if errors.Is(err, errNullValue) {
+				nullable = true
 				continue
 			}
 			return nil, errors.Wrapf(err, "parse value %q", raw)
@@ -30,7 +32,9 @@ func parseEnumValues(typ oas.SchemaType, rawValues []json.RawMessage) ([]interfa
 		unique[val] = struct{}{}
 		values = append(values, val)
 	}
-
+	if nullable {
+		values = append(values, nil)
+	}
 	return values, nil
 }
 
diff --git a/internal/sample_api/oas_json_gen.go b/internal/sample_api/oas_json_gen.go
index 7b823313..d86698c7 100644
--- a/internal/sample_api/oas_json_gen.go
+++ b/internal/sample_api/oas_json_gen.go
@@ -110,16 +110,26 @@ func (s Data) Encode(e *jx.Writer) {
 		e.RawStr("\"base64\"" + ":")
 		e.Base64(s.Base64)
 	}
+	{
+		if s.NullableEnum.Set {
+			e.Comma()
+		}
+		if s.NullableEnum.Set {
+			e.RawStr("\"nullable_enum\"" + ":")
+			s.NullableEnum.Encode(e)
+		}
+	}
 	e.ObjEnd()
 }
 
-var jsonFieldsNameOfData = [6]string{
+var jsonFieldsNameOfData = [7]string{
 	0: "id",
 	1: "description",
 	2: "email",
 	3: "hostname",
 	4: "format",
 	5: "base64",
+	6: "nullable_enum",
 }
 
 // Decode decodes Data from json.
@@ -168,6 +178,11 @@ func (s *Data) Decode(d *jx.Decoder) error {
 			if err != nil {
 				return err
 			}
+		case "nullable_enum":
+			s.NullableEnum.Reset()
+			if err := s.NullableEnum.Decode(d); err != nil {
+				return err
+			}
 		default:
 			return d.Skip()
 		}
@@ -783,6 +798,74 @@ func (s *ID) Decode(d *jx.Decoder) error {
 	return nil
 }
 
+// Encode encodes NullableEnumsBoth as json.
+func (o NilNullableEnumsBoth) Encode(e *jx.Writer) {
+	if o.Null {
+		e.Null()
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes NullableEnumsBoth from json.
+func (o *NilNullableEnumsBoth) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode NilNullableEnumsBoth to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Null = false
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	case jx.Null:
+		if err := d.Null(); err != nil {
+			return err
+		}
+		var v NullableEnumsBoth
+		o.Value = v
+		o.Null = true
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading NilNullableEnumsBoth`, d.Next())
+	}
+}
+
+// Encode encodes NullableEnumsOnlyNullValue as json.
+func (o NilNullableEnumsOnlyNullValue) Encode(e *jx.Writer) {
+	if o.Null {
+		e.Null()
+		return
+	}
+	e.Str(string(o.Value))
+}
+
+// Decode decodes NullableEnumsOnlyNullValue from json.
+func (o *NilNullableEnumsOnlyNullValue) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode NilNullableEnumsOnlyNullValue to nil`)
+	}
+	switch d.Next() {
+	case jx.String:
+		o.Null = false
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	case jx.Null:
+		if err := d.Null(); err != nil {
+			return err
+		}
+		var v NullableEnumsOnlyNullValue
+		o.Value = v
+		o.Null = true
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading NilNullableEnumsOnlyNullValue`, d.Next())
+	}
+}
+
 // Encode encodes string as json.
 func (o NilString) Encode(e *jx.Writer) {
 	if o.Null {
@@ -850,6 +933,190 @@ func (s *NotFound) Decode(d *jx.Decoder) error {
 	return nil
 }
 
+// Encode implements json.Marshaler.
+func (s NullableEnums) Encode(e *jx.Writer) {
+	e.ObjStart()
+	var (
+		first = true
+		_     = first
+	)
+	{
+		if !first {
+			e.Comma()
+		}
+		first = false
+
+		e.RawStr("\"only_nullable\"" + ":")
+		s.OnlyNullable.Encode(e)
+	}
+	{
+		e.Comma()
+
+		e.RawStr("\"only_null_value\"" + ":")
+		s.OnlyNullValue.Encode(e)
+	}
+	{
+		e.Comma()
+
+		e.RawStr("\"both\"" + ":")
+		s.Both.Encode(e)
+	}
+	e.ObjEnd()
+}
+
+var jsonFieldsNameOfNullableEnums = [3]string{
+	0: "only_nullable",
+	1: "only_null_value",
+	2: "both",
+}
+
+// Decode decodes NullableEnums from json.
+func (s *NullableEnums) Decode(d *jx.Decoder) error {
+	if s == nil {
+		return errors.New(`invalid: unable to decode NullableEnums to nil`)
+	}
+	var requiredBitSet [1]uint8
+
+	if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
+		switch string(k) {
+		case "only_nullable":
+			requiredBitSet[0] |= 1 << 0
+			if err := s.OnlyNullable.Decode(d); err != nil {
+				return err
+			}
+		case "only_null_value":
+			requiredBitSet[0] |= 1 << 1
+			if err := s.OnlyNullValue.Decode(d); err != nil {
+				return err
+			}
+		case "both":
+			requiredBitSet[0] |= 1 << 2
+			if err := s.Both.Decode(d); err != nil {
+				return err
+			}
+		default:
+			return d.Skip()
+		}
+		return nil
+	}); err != nil {
+		return err
+	}
+	var failures []validate.FieldError
+	for i, mask := range [1]uint8{
+		0b00000111,
+	} {
+		if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
+			// Mask only required fields and check equality to mask using XOR.
+			//
+			// If XOR result is not zero, result is not equal to expected, so some fields are missed.
+			// Bits of fields which would be set are actually bits of missed fields.
+			missed := bits.OnesCount8(result)
+			for bitN := 0; bitN < missed; bitN++ {
+				bitIdx := bits.TrailingZeros8(result)
+				fieldIdx := i*8 + bitIdx
+				var name string
+				if fieldIdx < len(jsonFieldsNameOfNullableEnums) {
+					name = jsonFieldsNameOfNullableEnums[fieldIdx]
+				} else {
+					name = strconv.Itoa(fieldIdx)
+				}
+				failures = append(failures, validate.FieldError{
+					Name:  name,
+					Error: validate.ErrFieldRequired,
+				})
+				// Reset bit.
+				result &^= 1 << bitIdx
+			}
+		}
+	}
+	if len(failures) > 0 {
+		return &validate.Error{Fields: failures}
+	}
+
+	return nil
+}
+
+// Encode encodes NullableEnumsBoth as json.
+func (s NullableEnumsBoth) Encode(e *jx.Writer) {
+	e.Str(string(s))
+}
+
+// Decode decodes NullableEnumsBoth from json.
+func (s *NullableEnumsBoth) Decode(d *jx.Decoder) error {
+	if s == nil {
+		return errors.New(`invalid: unable to decode NullableEnumsBoth to nil`)
+	}
+	v, err := d.StrBytes()
+	if err != nil {
+		return err
+	}
+	// Try to use constant string.
+	switch NullableEnumsBoth(v) {
+	case NullableEnumsBothAsc:
+		*s = NullableEnumsBothAsc
+	case NullableEnumsBothDesc:
+		*s = NullableEnumsBothDesc
+	default:
+		*s = NullableEnumsBoth(v)
+	}
+
+	return nil
+}
+
+// Encode encodes NullableEnumsOnlyNullValue as json.
+func (s NullableEnumsOnlyNullValue) Encode(e *jx.Writer) {
+	e.Str(string(s))
+}
+
+// Decode decodes NullableEnumsOnlyNullValue from json.
+func (s *NullableEnumsOnlyNullValue) Decode(d *jx.Decoder) error {
+	if s == nil {
+		return errors.New(`invalid: unable to decode NullableEnumsOnlyNullValue to nil`)
+	}
+	v, err := d.StrBytes()
+	if err != nil {
+		return err
+	}
+	// Try to use constant string.
+	switch NullableEnumsOnlyNullValue(v) {
+	case NullableEnumsOnlyNullValueAsc:
+		*s = NullableEnumsOnlyNullValueAsc
+	case NullableEnumsOnlyNullValueDesc:
+		*s = NullableEnumsOnlyNullValueDesc
+	default:
+		*s = NullableEnumsOnlyNullValue(v)
+	}
+
+	return nil
+}
+
+// Encode encodes NullableEnumsOnlyNullable as json.
+func (s NullableEnumsOnlyNullable) Encode(e *jx.Writer) {
+	e.Str(string(s))
+}
+
+// Decode decodes NullableEnumsOnlyNullable from json.
+func (s *NullableEnumsOnlyNullable) Decode(d *jx.Decoder) error {
+	if s == nil {
+		return errors.New(`invalid: unable to decode NullableEnumsOnlyNullable to nil`)
+	}
+	v, err := d.StrBytes()
+	if err != nil {
+		return err
+	}
+	// Try to use constant string.
+	switch NullableEnumsOnlyNullable(v) {
+	case NullableEnumsOnlyNullableAsc:
+		*s = NullableEnumsOnlyNullableAsc
+	case NullableEnumsOnlyNullableDesc:
+		*s = NullableEnumsOnlyNullableDesc
+	default:
+		*s = NullableEnumsOnlyNullable(v)
+	}
+
+	return nil
+}
+
 // Encode encodes Data as json.
 func (o OptData) Encode(e *jx.Writer) {
 	if !o.Set {
@@ -1019,6 +1286,31 @@ func (o *OptNilString) Decode(d *jx.Decoder) error {
 	}
 }
 
+// Encode encodes NullableEnums as json.
+func (o OptNullableEnums) Encode(e *jx.Writer) {
+	if !o.Set {
+		return
+	}
+	o.Value.Encode(e)
+}
+
+// Decode decodes NullableEnums from json.
+func (o *OptNullableEnums) Decode(d *jx.Decoder) error {
+	if o == nil {
+		return errors.New(`invalid: unable to decode OptNullableEnums to nil`)
+	}
+	switch d.Next() {
+	case jx.Object:
+		o.Set = true
+		if err := o.Value.Decode(d); err != nil {
+			return err
+		}
+		return nil
+	default:
+		return errors.Errorf(`unexpected type %q while reading OptNullableEnums`, d.Next())
+	}
+}
+
 // Encode encodes Pet as json.
 func (o OptPet) Encode(e *jx.Writer) {
 	if !o.Set {
diff --git a/internal/sample_api/oas_schemas_gen.go b/internal/sample_api/oas_schemas_gen.go
index df58cab1..3d038077 100644
--- a/internal/sample_api/oas_schemas_gen.go
+++ b/internal/sample_api/oas_schemas_gen.go
@@ -66,12 +66,13 @@ var (
 
 // Ref: #/components/schemas/Data
 type Data struct {
-	ID          ID              `json:"id"`
-	Description DataDescription `json:"description"`
-	Email       string          `json:"email"`
-	Hostname    string          `json:"hostname"`
-	Format      string          `json:"format"`
-	Base64      []byte          `json:"base64"`
+	ID           ID               `json:"id"`
+	Description  DataDescription  `json:"description"`
+	Email        string           `json:"email"`
+	Hostname     string           `json:"hostname"`
+	Format       string           `json:"format"`
+	Base64       []byte           `json:"base64"`
+	NullableEnum OptNullableEnums `json:"nullable_enum"`
 }
 
 // DataDescription represents sum type.
@@ -249,6 +250,82 @@ func NewIntID(v int) ID {
 	return s
 }
 
+// NewNilNullableEnumsBoth returns new NilNullableEnumsBoth with value set to v.
+func NewNilNullableEnumsBoth(v NullableEnumsBoth) NilNullableEnumsBoth {
+	return NilNullableEnumsBoth{
+		Value: v,
+	}
+}
+
+// NilNullableEnumsBoth is nullable NullableEnumsBoth.
+type NilNullableEnumsBoth struct {
+	Value NullableEnumsBoth
+	Null  bool
+}
+
+// SetTo sets value to v.
+func (o *NilNullableEnumsBoth) SetTo(v NullableEnumsBoth) {
+	o.Null = false
+	o.Value = v
+}
+
+// IsSet returns true if value is Null.
+func (o NilNullableEnumsBoth) IsNull() bool { return o.Null }
+
+// Get returns value and boolean that denotes whether value was set.
+func (o NilNullableEnumsBoth) Get() (v NullableEnumsBoth, ok bool) {
+	if o.Null {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o NilNullableEnumsBoth) Or(d NullableEnumsBoth) NullableEnumsBoth {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
+// NewNilNullableEnumsOnlyNullValue returns new NilNullableEnumsOnlyNullValue with value set to v.
+func NewNilNullableEnumsOnlyNullValue(v NullableEnumsOnlyNullValue) NilNullableEnumsOnlyNullValue {
+	return NilNullableEnumsOnlyNullValue{
+		Value: v,
+	}
+}
+
+// NilNullableEnumsOnlyNullValue is nullable NullableEnumsOnlyNullValue.
+type NilNullableEnumsOnlyNullValue struct {
+	Value NullableEnumsOnlyNullValue
+	Null  bool
+}
+
+// SetTo sets value to v.
+func (o *NilNullableEnumsOnlyNullValue) SetTo(v NullableEnumsOnlyNullValue) {
+	o.Null = false
+	o.Value = v
+}
+
+// IsSet returns true if value is Null.
+func (o NilNullableEnumsOnlyNullValue) IsNull() bool { return o.Null }
+
+// Get returns value and boolean that denotes whether value was set.
+func (o NilNullableEnumsOnlyNullValue) Get() (v NullableEnumsOnlyNullValue, ok bool) {
+	if o.Null {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o NilNullableEnumsOnlyNullValue) Or(d NullableEnumsOnlyNullValue) NullableEnumsOnlyNullValue {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
 // NewNilString returns new NilString with value set to v.
 func NewNilString(v string) NilString {
 	return NilString{
@@ -295,6 +372,34 @@ func (*NotFound) foobarPostRes()          {}
 func (*NotFound) petGetAvatarByIDRes()    {}
 func (*NotFound) petUploadAvatarByIDRes() {}
 
+// Ref: #/components/schemas/NullableEnums
+type NullableEnums struct {
+	OnlyNullable  NullableEnumsOnlyNullable     `json:"only_nullable"`
+	OnlyNullValue NilNullableEnumsOnlyNullValue `json:"only_null_value"`
+	Both          NilNullableEnumsBoth          `json:"both"`
+}
+
+type NullableEnumsBoth string
+
+const (
+	NullableEnumsBothAsc  NullableEnumsBoth = "asc"
+	NullableEnumsBothDesc NullableEnumsBoth = "desc"
+)
+
+type NullableEnumsOnlyNullValue string
+
+const (
+	NullableEnumsOnlyNullValueAsc  NullableEnumsOnlyNullValue = "asc"
+	NullableEnumsOnlyNullValueDesc NullableEnumsOnlyNullValue = "desc"
+)
+
+type NullableEnumsOnlyNullable string
+
+const (
+	NullableEnumsOnlyNullableAsc  NullableEnumsOnlyNullable = "asc"
+	NullableEnumsOnlyNullableDesc NullableEnumsOnlyNullable = "desc"
+)
+
 // NewOptData returns new OptData with value set to v.
 func NewOptData(v Data) OptData {
 	return OptData{
@@ -580,6 +685,52 @@ func (o OptNilString) Or(d string) string {
 	return d
 }
 
+// NewOptNullableEnums returns new OptNullableEnums with value set to v.
+func NewOptNullableEnums(v NullableEnums) OptNullableEnums {
+	return OptNullableEnums{
+		Value: v,
+		Set:   true,
+	}
+}
+
+// OptNullableEnums is optional NullableEnums.
+type OptNullableEnums struct {
+	Value NullableEnums
+	Set   bool
+}
+
+// IsSet returns true if OptNullableEnums was set.
+func (o OptNullableEnums) IsSet() bool { return o.Set }
+
+// Reset unsets value.
+func (o *OptNullableEnums) Reset() {
+	var v NullableEnums
+	o.Value = v
+	o.Set = false
+}
+
+// SetTo sets value to v.
+func (o *OptNullableEnums) SetTo(v NullableEnums) {
+	o.Set = true
+	o.Value = v
+}
+
+// Get returns value and boolean that denotes whether value was set.
+func (o OptNullableEnums) Get() (v NullableEnums, ok bool) {
+	if !o.Set {
+		return v, false
+	}
+	return o.Value, true
+}
+
+// Or returns value if set, or given parameter if does not.
+func (o OptNullableEnums) Or(d NullableEnums) NullableEnums {
+	if v, ok := o.Get(); ok {
+		return v
+	}
+	return d
+}
+
 // NewOptPet returns new OptPet with value set to v.
 func NewOptPet(v Pet) OptPet {
 	return OptPet{
diff --git a/internal/sample_api/oas_validators_gen.go b/internal/sample_api/oas_validators_gen.go
index c2d50263..7407beec 100644
--- a/internal/sample_api/oas_validators_gen.go
+++ b/internal/sample_api/oas_validators_gen.go
@@ -123,6 +123,25 @@ func (s Data) Validate() error {
 			Error: err,
 		})
 	}
+	if err := func() error {
+		if s.NullableEnum.Set {
+			if err := func() error {
+				if err := s.NullableEnum.Value.Validate(); err != nil {
+					return err
+				}
+				return nil
+			}(); err != nil {
+				return err
+			}
+		}
+		return nil
+		return nil
+	}(); err != nil {
+		failures = append(failures, validate.FieldError{
+			Name:  "nullable_enum",
+			Error: err,
+		})
+	}
 	if len(failures) > 0 {
 		return &validate.Error{Fields: failures}
 	}
@@ -155,6 +174,79 @@ func (s Hash) Validate() error {
 	return nil
 }
 
+func (s NullableEnums) Validate() error {
+	var failures []validate.FieldError
+	if err := func() error {
+		if err := s.OnlyNullable.Validate(); err != nil {
+			return err
+		}
+		return nil
+	}(); err != nil {
+		failures = append(failures, validate.FieldError{
+			Name:  "only_nullable",
+			Error: err,
+		})
+	}
+	if err := func() error {
+		if err := s.OnlyNullValue.Value.Validate(); err != nil {
+			return err
+		}
+		return nil
+		return nil
+	}(); err != nil {
+		failures = append(failures, validate.FieldError{
+			Name:  "only_null_value",
+			Error: err,
+		})
+	}
+	if err := func() error {
+		if err := s.Both.Value.Validate(); err != nil {
+			return err
+		}
+		return nil
+		return nil
+	}(); err != nil {
+		failures = append(failures, validate.FieldError{
+			Name:  "both",
+			Error: err,
+		})
+	}
+	if len(failures) > 0 {
+		return &validate.Error{Fields: failures}
+	}
+	return nil
+}
+func (s NullableEnumsBoth) Validate() error {
+	switch s {
+	case "asc":
+		return nil
+	case "desc":
+		return nil
+	default:
+		return errors.Errorf("invalid value: %v", s)
+	}
+}
+func (s NullableEnumsOnlyNullValue) Validate() error {
+	switch s {
+	case "asc":
+		return nil
+	case "desc":
+		return nil
+	default:
+		return errors.Errorf("invalid value: %v", s)
+	}
+}
+func (s NullableEnumsOnlyNullable) Validate() error {
+	switch s {
+	case "asc":
+		return nil
+	case "desc":
+		return nil
+	default:
+		return errors.Errorf("invalid value: %v", s)
+	}
+}
+
 func (s Pet) Validate() error {
 	var failures []validate.FieldError
 	if err := func() error {


Test patch:
diff --git a/_testdata/sample.json b/_testdata/sample.json
index f3b4bdcb..7abc5b7f 100644
--- a/_testdata/sample.json
+++ b/_testdata/sample.json
@@ -523,6 +523,44 @@
           }
         }
       },
+      "NullableEnums": {
+        "type": "object",
+        "required": [
+          "only_nullable",
+          "only_null_value",
+          "both"
+        ],
+        "properties": {
+          "only_nullable": {
+            "type": "string",
+            "nullable": true,
+            "description": "must not be nullable",
+            "enum": [
+              "asc",
+              "desc"
+            ]
+          },
+          "only_null_value": {
+            "type": "string",
+            "description": "must be nullable",
+            "enum": [
+              "asc",
+              "desc",
+              null
+            ]
+          },
+          "both": {
+            "type": "string",
+            "nullable": true,
+            "description": "must be nullable",
+            "enum": [
+              "asc",
+              "desc",
+              null
+            ]
+          }
+        }
+      },
       "Data": {
         "type": "object",
         "required": [
@@ -561,6 +599,9 @@
           "base64": {
             "type": "string",
             "format": "byte"
+          },
+          "nullable_enum": {
+            "$ref": "#/components/schemas/NullableEnums"
           }
         }
       },
diff --git a/json_test.go b/json_test.go
index 319d9169..b4952d03 100644
--- a/json_test.go
+++ b/json_test.go
@@ -307,3 +307,23 @@ func TestValidateRequired(t *testing.T) {
 		})
 	}
 }
+
+func TestNullableEnum(t *testing.T) {
+	for _, tc := range []struct {
+		Type json.Unmarshaler
+		Err  bool
+	}{
+		{new(api.NullableEnumsOnlyNullable), true},
+		{new(api.NilNullableEnumsOnlyNullValue), false},
+		{new(api.NilNullableEnumsBoth), false},
+	} {
+		t.Run(fmt.Sprintf("%T", tc.Type), func(t *testing.T) {
+			checker := require.NoError
+			if tc.Err {
+				checker = require.Error
+			}
+			checker(t, tc.Type.Decode(jx.DecodeStr(`null`)))
+			require.NoError(t, tc.Type.Decode(jx.DecodeStr(`"asc"`)))
+		})
+	}
+}