Summary
YAML resolves plain scalars like 2021-01-01 to the !!timestamp tag. scalarValue has no case for that tag and errors with "unsupported scalar tag", and the failure cascades differently by position:
default: — dropped with a warning diagnostic.
example:/examples: — dropped silently (conversion errors are discarded).
enum: — worst case: one unconvertible member makes enumMembers bail, the enum falls to enumAsUnion, and every date member is re-converted via valueOrNull into a null literal. The actual enum values are destroyed, not preserved: enum: [2021-01-01, 2022-02-02] becomes a union of two literals whose values are both ValueNull.
Dates in defaults/enums are routine spec content, and YAML does not require quoting them.
Reproduction
openapi: 3.1.0
info: {title: t, version: '1'}
paths: {}
components:
schemas:
D:
type: string
format: date
default: 2021-01-01
enum: [2021-01-01, 2022-02-02]
Result: Default=nil; a Union of two Literals both kind=null; diagnostics default: openapi: unsupported scalar tag "!!timestamp" and heterogeneous or non-scalar enum lowered as a union of literals.
Root cause
compilers/openapi/value.go:48-88 (no !!timestamp case in scalarValue); enum destruction via compose.go:379-399 + 437-445 (enumAsUnion + valueOrNull mapping conversion failure to a null literal); silent example drop at schema.go:556-569.
Expected
!!timestamp scalars should be captured as their string spelling (ValueStr) — the schema declares type: string; the tag is a YAML parsing artifact, not source semantics. Independently: a failed value conversion must never silently become a null literal, and example-conversion errors must not be discarded.
Summary
YAML resolves plain scalars like
2021-01-01to the!!timestamptag.scalarValuehas no case for that tag and errors with "unsupported scalar tag", and the failure cascades differently by position:default:— dropped with a warning diagnostic.example:/examples:— dropped silently (conversion errors are discarded).enum:— worst case: one unconvertible member makesenumMembersbail, the enum falls toenumAsUnion, and every date member is re-converted viavalueOrNullinto anullliteral. The actual enum values are destroyed, not preserved:enum: [2021-01-01, 2022-02-02]becomes a union of two literals whose values are bothValueNull.Dates in defaults/enums are routine spec content, and YAML does not require quoting them.
Reproduction
Result:
Default=nil; a Union of two Literals bothkind=null; diagnosticsdefault: openapi: unsupported scalar tag "!!timestamp"andheterogeneous or non-scalar enum lowered as a union of literals.Root cause
compilers/openapi/value.go:48-88(no!!timestampcase inscalarValue); enum destruction viacompose.go:379-399+437-445(enumAsUnion+valueOrNullmapping conversion failure to a null literal); silent example drop atschema.go:556-569.Expected
!!timestampscalars should be captured as their string spelling (ValueStr) — the schema declarestype: string; the tag is a YAML parsing artifact, not source semantics. Independently: a failed value conversion must never silently become anullliteral, and example-conversion errors must not be discarded.