Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`date` → `date-time` (and `time` → `date-time`) is classified as a widening, but a date is not a valid date-time

Đang mở Phù hợp với người mới
#1,281 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@reuvenharrison đang làm issue này rồi.

Từ ngày 7/10/2026.

  • #1285 của @reuvenharrison — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu với isFormatContained trong checker/check_types.go và bảng containment định dạng của nó; đọc cách request-property-type-generalized và request-property-type-changed được phát ra. Xóa các mục date/time → date-time để những thay đổi đó rơi vào đường dẫn type-changed, sau đó chạy các bài test của checker (tìm các test hiện có khẳng định thông điệp generalized cho trường hợp này) và kiểm chứng bằng các lệnh tái tạo oasdiff breaking và oasdiff changelog từ issue. Xong = thay đổi được báo cáo là lỗi và các cặp integer/number vẫn pass với tư cách widening.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

oasdiff version: 1.33.0

isFormatContained in checker/check_types.go treats date → date-time and time → date-time as a widening (the old format "contained" in the new one). For string formats that does not hold: per RFC 3339 / JSON Schema, 2020-01-01 is a valid date but not a valid date-time (which needs the T, the time and the offset), and 10:00:00Z is a valid time but not a date-time. The value sets are disjoint, so on a request this is a narrowing that rejects every payload that was valid before.

Base (base.yaml)
openapi: 3.0.3
info: {title: t, version: '1'}
paths:
  /pets:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                born: {type: string, format: date}
      responses:
        '204': {description: ok}
Revision (revision.yaml)

Same, with format: date-time instead of format: date.

Command
oasdiff breaking base.yaml revision.yaml
oasdiff changelog base.yaml revision.yaml
Actual (abridged)
No breaking changes to report, but the specs are different.

1 changes: 0 error, 0 warning, 1 info
info	[request-property-type-generalized]
	in API POST /pets
		the `born` request property `format` was widened from `date` to `date-time`
Expected

An error (request-property-type-changed): a client sending {"born": "2020-01-01"} is rejected by a server validating date-time. The integer/number pairs in the same function (int32 → int64, float → double) are genuine containments; the two string pairs are not, and could simply be dropped from the table so the change falls through to "type changed".

Noticed while comparing results across differs.

Ngôn ngữ chính
Go
Star
1.4k
Fork
109
Merge trung bình
11 giờ 5 phút
Pull request đã merge (30 ngày)
32

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của oasdiff/oasdiff

Tất cả issue của oasdiff/oasdiff

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.