diff --git a/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json b/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json index a106abe..36897fc 100644 --- a/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json +++ b/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json @@ -674,15 +674,11 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "constEnum": { @@ -693,88 +689,64 @@ "type": "string" }, "constFixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constFixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "constFloat": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "constInt32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constInt64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constUint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json b/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json index 8258635..9eaf18a 100644 --- a/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json +++ b/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json @@ -1162,17 +1162,13 @@ "type": "string" }, "^(constBool)$": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "^(constDouble)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -1201,9 +1197,7 @@ "^(constFixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1218,9 +1212,7 @@ "^(constFixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -1234,9 +1226,7 @@ "^(constFloat)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -1251,9 +1241,7 @@ "^(constInt32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1267,9 +1255,7 @@ "^(constInt64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1281,9 +1267,7 @@ "^(constSfixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1297,9 +1281,7 @@ "^(constSfixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1311,9 +1293,7 @@ "^(constSint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1327,9 +1307,7 @@ "^(constSint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1339,17 +1317,13 @@ ] }, "^(constString)$": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "^(constUint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1363,9 +1337,7 @@ "^(constUint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2648,17 +2620,13 @@ "type": "string" }, "const_bool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "const_double": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -2687,9 +2655,7 @@ "const_fixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2704,9 +2670,7 @@ "const_fixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2720,9 +2684,7 @@ "const_float": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -2737,9 +2699,7 @@ "const_int32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2753,9 +2713,7 @@ "const_int64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2767,9 +2725,7 @@ "const_sfixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2783,9 +2739,7 @@ "const_sfixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2797,9 +2751,7 @@ "const_sint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2813,9 +2765,7 @@ "const_sint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2825,17 +2775,13 @@ ] }, "const_string": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "const_uint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2849,9 +2795,7 @@ "const_uint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json b/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json index 2585a52..fd61f80 100644 --- a/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json +++ b/internal/gen/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json @@ -674,15 +674,11 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "constEnum": { @@ -693,88 +689,64 @@ "type": "string" }, "constFixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constFixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "constFloat": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "constInt32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constInt64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constUint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/protoschema/jsonschema/jsonschema.go b/internal/protoschema/jsonschema/jsonschema.go index 5e8d600..11ff990 100644 --- a/internal/protoschema/jsonschema/jsonschema.go +++ b/internal/protoschema/jsonschema/jsonschema.go @@ -536,7 +536,7 @@ func (p *Generator) generateBoolValidation(field protoreflect.FieldDescriptor, h } p.generateDefault(field, hasImplicitPresence, rules, schema) if rules.GetBool() != nil && rules.GetBool().Const != nil { - schema["enum"] = []bool{rules.GetBool().GetConst()} + schema["const"] = rules.GetBool().GetConst() } } @@ -684,7 +684,7 @@ type numberRule[T comparable] interface { func generateConstInValidation[T comparable](rules baseRule[T], schema map[string]any) { if rules.HasConst() { - schema["enum"] = []T{rules.GetConst()} + schema["const"] = rules.GetConst() } else if len(rules.GetIn()) > 0 { schema["enum"] = rules.GetIn() } @@ -984,7 +984,7 @@ func (p *Generator) generateFloatValidation(field protoreflect.FieldDescriptor, includeNaN = false } if rules.GetFloat().Const != nil { - numberSchema["enum"] = []float32{rules.GetFloat().GetConst()} + numberSchema["const"] = rules.GetFloat().GetConst() includePosInf = false includeNegInf = false includeNaN = false @@ -1080,7 +1080,7 @@ func (p *Generator) generateFloatValidation(field protoreflect.FieldDescriptor, includeNaN = false } if rules.GetDouble().Const != nil { - numberSchema["enum"] = []float64{rules.GetDouble().GetConst()} + numberSchema["const"] = rules.GetDouble().GetConst() includePosInf = false includeNegInf = false includeNaN = false @@ -1361,7 +1361,7 @@ func (p *Generator) generateStringValidation(field protoreflect.FieldDescriptor, } if rules.GetString().Const != nil { - schema["enum"] = []string{rules.GetString().GetConst()} + schema["const"] = rules.GetString().GetConst() } else if len(rules.GetString().GetIn()) > 0 { schema["enum"] = rules.GetString().GetIn() } diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.bundle.json index 89dbcd2..32d7527 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.bundle.json @@ -1403,17 +1403,13 @@ "type": "string" }, "^(const_bool)$": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "^(const_double)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -1442,9 +1438,7 @@ "^(const_fixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1459,9 +1453,7 @@ "^(const_fixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -1475,9 +1467,7 @@ "^(const_float)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -1492,9 +1482,7 @@ "^(const_int32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1508,9 +1496,7 @@ "^(const_int64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1522,9 +1508,7 @@ "^(const_sfixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1538,9 +1522,7 @@ "^(const_sfixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1552,9 +1534,7 @@ "^(const_sint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1568,9 +1548,7 @@ "^(const_sint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1580,17 +1558,13 @@ ] }, "^(const_string)$": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "^(const_uint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1604,9 +1578,7 @@ "^(const_uint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2889,17 +2861,13 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -2928,9 +2896,7 @@ "constFixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2945,9 +2911,7 @@ "constFixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2961,9 +2925,7 @@ "constFloat": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -2978,9 +2940,7 @@ "constInt32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2994,9 +2954,7 @@ "constInt64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3008,9 +2966,7 @@ "constSfixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3024,9 +2980,7 @@ "constSfixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3038,9 +2992,7 @@ "constSint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3054,9 +3006,7 @@ "constSint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3066,17 +3016,13 @@ ] }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -3090,9 +3036,7 @@ "constUint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.json index 85d47a4..ab791b3 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.json @@ -1162,17 +1162,13 @@ "type": "string" }, "^(const_bool)$": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "^(const_double)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -1201,9 +1197,7 @@ "^(const_fixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1218,9 +1212,7 @@ "^(const_fixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -1234,9 +1226,7 @@ "^(const_float)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -1251,9 +1241,7 @@ "^(const_int32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1267,9 +1255,7 @@ "^(const_int64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1281,9 +1267,7 @@ "^(const_sfixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1297,9 +1281,7 @@ "^(const_sfixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1311,9 +1293,7 @@ "^(const_sint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1327,9 +1307,7 @@ "^(const_sint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1339,17 +1317,13 @@ ] }, "^(const_string)$": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "^(const_uint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1363,9 +1337,7 @@ "^(const_uint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2648,17 +2620,13 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -2687,9 +2655,7 @@ "constFixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2704,9 +2670,7 @@ "constFixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2720,9 +2684,7 @@ "constFloat": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -2737,9 +2699,7 @@ "constInt32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2753,9 +2713,7 @@ "constInt64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2767,9 +2725,7 @@ "constSfixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2783,9 +2739,7 @@ "constSfixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2797,9 +2751,7 @@ "constSint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2813,9 +2765,7 @@ "constSint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2825,17 +2775,13 @@ ] }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2849,9 +2795,7 @@ "constUint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json index 0fd5230..3ceb776 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.bundle.json @@ -674,15 +674,11 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "constEnum": { @@ -693,88 +689,64 @@ "type": "string" }, "constFixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constFixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "constFloat": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "constInt32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constInt64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constUint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.json index 630db76..78afa1b 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.jsonschema.strict.json @@ -592,15 +592,11 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "constEnum": { @@ -611,88 +607,64 @@ "type": "string" }, "constFixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constFixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "constFloat": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "constInt32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constInt64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constUint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.bundle.json index 1ec7213..7ccf1e6 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.bundle.json @@ -1403,17 +1403,13 @@ "type": "string" }, "^(constBool)$": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "^(constDouble)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -1442,9 +1438,7 @@ "^(constFixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1459,9 +1453,7 @@ "^(constFixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -1475,9 +1467,7 @@ "^(constFloat)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -1492,9 +1482,7 @@ "^(constInt32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1508,9 +1496,7 @@ "^(constInt64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1522,9 +1508,7 @@ "^(constSfixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1538,9 +1522,7 @@ "^(constSfixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1552,9 +1534,7 @@ "^(constSint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1568,9 +1548,7 @@ "^(constSint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1580,17 +1558,13 @@ ] }, "^(constString)$": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "^(constUint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1604,9 +1578,7 @@ "^(constUint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2889,17 +2861,13 @@ "type": "string" }, "const_bool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "const_double": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -2928,9 +2896,7 @@ "const_fixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2945,9 +2911,7 @@ "const_fixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2961,9 +2925,7 @@ "const_float": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -2978,9 +2940,7 @@ "const_int32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2994,9 +2954,7 @@ "const_int64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3008,9 +2966,7 @@ "const_sfixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3024,9 +2980,7 @@ "const_sfixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3038,9 +2992,7 @@ "const_sint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3054,9 +3006,7 @@ "const_sint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3066,17 +3016,13 @@ ] }, "const_string": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "const_uint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -3090,9 +3036,7 @@ "const_uint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json index ecf110e..c60d922 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.json @@ -1162,17 +1162,13 @@ "type": "string" }, "^(constBool)$": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "^(constDouble)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -1201,9 +1197,7 @@ "^(constFixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1218,9 +1212,7 @@ "^(constFixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -1234,9 +1226,7 @@ "^(constFloat)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -1251,9 +1241,7 @@ "^(constInt32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1267,9 +1255,7 @@ "^(constInt64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1281,9 +1267,7 @@ "^(constSfixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1297,9 +1281,7 @@ "^(constSfixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1311,9 +1293,7 @@ "^(constSint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1327,9 +1307,7 @@ "^(constSint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1339,17 +1317,13 @@ ] }, "^(constString)$": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "^(constUint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1363,9 +1337,7 @@ "^(constUint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2648,17 +2620,13 @@ "type": "string" }, "const_bool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "const_double": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -2687,9 +2655,7 @@ "const_fixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2704,9 +2670,7 @@ "const_fixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2720,9 +2684,7 @@ "const_float": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -2737,9 +2699,7 @@ "const_int32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2753,9 +2713,7 @@ "const_int64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2767,9 +2725,7 @@ "const_sfixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2783,9 +2739,7 @@ "const_sfixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2797,9 +2751,7 @@ "const_sint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2813,9 +2765,7 @@ "const_sint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -2825,17 +2775,13 @@ ] }, "const_string": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "const_uint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2849,9 +2795,7 @@ "const_uint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.bundle.json index 648998f..310f90e 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.bundle.json @@ -674,15 +674,11 @@ "type": "string" }, "const_bool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "const_double": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "const_enum": { @@ -693,88 +689,64 @@ "type": "string" }, "const_fixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "const_fixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "const_float": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "const_int32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_int64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_sfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_sfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_sint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_sint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_string": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "const_uint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "const_uint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.json index fb2522d..045c9b0 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTest.schema.strict.json @@ -592,15 +592,11 @@ "type": "string" }, "const_bool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "const_double": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "const_enum": { @@ -611,88 +607,64 @@ "type": "string" }, "const_fixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "const_fixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "const_float": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "const_int32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_int64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_sfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_sfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_sint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_sint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_string": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "const_uint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "const_uint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.bundle.json index afeb63d..9f1e4ef 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.bundle.json @@ -1403,17 +1403,13 @@ "type": "string" }, "^(const_bool)$": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "^(const_double)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -1442,9 +1438,7 @@ "^(const_fixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1459,9 +1453,7 @@ "^(const_fixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -1475,9 +1467,7 @@ "^(const_float)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -1492,9 +1482,7 @@ "^(const_int32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1508,9 +1496,7 @@ "^(const_int64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1522,9 +1508,7 @@ "^(const_sfixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1538,9 +1522,7 @@ "^(const_sfixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1552,9 +1534,7 @@ "^(const_sint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1568,9 +1548,7 @@ "^(const_sint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1580,17 +1558,13 @@ ] }, "^(const_string)$": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "^(const_uint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1604,9 +1578,7 @@ "^(const_uint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2889,17 +2861,13 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -2928,9 +2896,7 @@ "constFixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2945,9 +2911,7 @@ "constFixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2961,9 +2925,7 @@ "constFloat": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -2978,9 +2940,7 @@ "constInt32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2994,9 +2954,7 @@ "constInt64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3008,9 +2966,7 @@ "constSfixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3024,9 +2980,7 @@ "constSfixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3038,9 +2992,7 @@ "constSint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3054,9 +3006,7 @@ "constSint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3066,17 +3016,13 @@ ] }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -3090,9 +3036,7 @@ "constUint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json index 6f2299b..bb9b546 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.jsonschema.strict.bundle.json @@ -674,15 +674,11 @@ "type": "string" }, "constBool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "constDouble": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "constEnum": { @@ -693,88 +689,64 @@ "type": "string" }, "constFixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constFixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "constFloat": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "constInt32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constInt64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constSint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "constSint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "constString": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "constUint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "constUint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.bundle.json index a945996..66e2e0c 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.bundle.json @@ -1403,17 +1403,13 @@ "type": "string" }, "^(constBool)$": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "^(constDouble)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -1442,9 +1438,7 @@ "^(constFixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1459,9 +1453,7 @@ "^(constFixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -1475,9 +1467,7 @@ "^(constFloat)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -1492,9 +1482,7 @@ "^(constInt32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1508,9 +1496,7 @@ "^(constInt64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1522,9 +1508,7 @@ "^(constSfixed32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1538,9 +1522,7 @@ "^(constSfixed64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1552,9 +1534,7 @@ "^(constSint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -1568,9 +1548,7 @@ "^(constSint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -1580,17 +1558,13 @@ ] }, "^(constString)$": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "^(constUint32)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -1604,9 +1578,7 @@ "^(constUint64)$": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2889,17 +2861,13 @@ "type": "string" }, "const_bool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "const_double": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, { @@ -2928,9 +2896,7 @@ "const_fixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -2945,9 +2911,7 @@ "const_fixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, @@ -2961,9 +2925,7 @@ "const_float": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" @@ -2978,9 +2940,7 @@ "const_int32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -2994,9 +2954,7 @@ "const_int64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3008,9 +2966,7 @@ "const_sfixed32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3024,9 +2980,7 @@ "const_sfixed64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3038,9 +2992,7 @@ "const_sint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" @@ -3054,9 +3006,7 @@ "const_sint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, { @@ -3066,17 +3016,13 @@ ] }, "const_string": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "const_uint32": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" @@ -3090,9 +3036,7 @@ "const_uint64": { "anyOf": [ { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, diff --git a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.strict.bundle.json b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.strict.bundle.json index 48dc09f..feff083 100644 --- a/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.strict.bundle.json +++ b/internal/testdata/jsonschema/buf.protoschema.test.v1.ConstraintTests.schema.strict.bundle.json @@ -674,15 +674,11 @@ "type": "string" }, "const_bool": { - "enum": [ - false - ], + "const": false, "type": "boolean" }, "const_double": { - "enum": [ - 5 - ], + "const": 5, "type": "number" }, "const_enum": { @@ -693,88 +689,64 @@ "type": "string" }, "const_fixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "const_fixed64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" }, "const_float": { - "enum": [ - 5 - ], + "const": 5, "maximum": 3.4028234663852886e+38, "minimum": -3.4028234663852886e+38, "type": "number" }, "const_int32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_int64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_sfixed32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_sfixed64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_sint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 2147483648, "minimum": -2147483648, "type": "integer" }, "const_sint64": { - "enum": [ - 5 - ], + "const": 5, "type": "integer" }, "const_string": { - "enum": [ - "const" - ], + "const": "const", "type": "string" }, "const_uint32": { - "enum": [ - 5 - ], + "const": 5, "exclusiveMaximum": 4294967296, "minimum": 0, "type": "integer" }, "const_uint64": { - "enum": [ - 5 - ], + "const": 5, "minimum": 0, "type": "integer" },