-- in.cue --
#Foo: string

#LoadBalancerSettings: {
	{} | {
		consistentHash: #ConsistentHashLB
		b:              #Foo
	}
	#ConsistentHashLB: {} | {
		httpHeaderName: string
	}
}

-- out/TestGenerateOpenAPI/out.json --
{
   "openapi": "3.0.0",
   "info": {
      "title": "Generated by cue.",
      "version": "no version"
   },
   "paths": {},
   "components": {
      "schemas": {
         "Foo": {
            "type": "string"
         },
         "LoadBalancerSettings": {
            "type": "object",
            "oneOf": [
               {
                  "not": {
                     "anyOf": [
                        {
                           "required": [
                              "consistentHash",
                              "b"
                           ],
                           "properties": {
                              "consistentHash": {
                                 "$ref": "#/components/schemas/LoadBalancerSettings.ConsistentHashLB"
                              },
                              "b": {
                                 "$ref": "#/components/schemas/Foo"
                              }
                           }
                        }
                     ]
                  }
               },
               {
                  "required": [
                     "consistentHash",
                     "b"
                  ],
                  "properties": {
                     "consistentHash": {
                        "$ref": "#/components/schemas/LoadBalancerSettings.ConsistentHashLB"
                     },
                     "b": {
                        "$ref": "#/components/schemas/Foo"
                     }
                  }
               }
            ]
         },
         "LoadBalancerSettings.ConsistentHashLB": {
            "type": "object",
            "oneOf": [
               {
                  "not": {
                     "anyOf": [
                        {
                           "required": [
                              "httpHeaderName"
                           ],
                           "properties": {
                              "httpHeaderName": {
                                 "type": "string"
                              }
                           }
                        }
                     ]
                  }
               },
               {
                  "required": [
                     "httpHeaderName"
                  ],
                  "properties": {
                     "httpHeaderName": {
                        "type": "string"
                     }
                  }
               }
            ]
         }
      }
   }
}