# Tests for root-level definition reference closedness.
#
# Issue 4356: when the root value is solely a reference to a definition,
# additionalProperties: false should not appear at the root because it
# conflicts with the $ref (additionalProperties only considers properties
# in the same schema object, and the root has none).
-- test.cue --
package test

#T

#T: {
	a?: int
	b?: string
}
-- out/generate-v3/schema --
{
	$schema: "https://json-schema.org/draft/2020-12/schema"
	$defs: {
		T: {
			type:                 "object"
			additionalProperties: false
			properties: {
				a: {
					type: "integer"
				}
				b: {
					type: "string"
				}
			}
		}
	}
	type: "object"
	$ref: "#/$defs/T"
}
