How to replace the value list of an array?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- yaml
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu với phần Action Object của Overlay Specification và so sánh cách diễn đạt về việc hợp nhất trong đó với các ví dụ OpenAPI và Overlay YAML được cung cấp. Xác nhận liệu việc cập nhật x-bar phải thay thế hay nối thêm vào array, và ghi lại hành vi dự kiến hoặc giải pháp tạm thời remove-and-readd trong Specification.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I want to replace the value list of an array with a new list of values. However, the two overlay implementations I've tried treat the following example as "append to an array" rather than "replace an array".
I'm not sure if the implementation behavior is correct or a bug, so wanted to confirm the intended behavior with the spec authors.
OpenAPI document:
openapi: 1.0.0
info:
title: Array replacement test
version: 1.0.0
paths: {}
x-foo:
x-bar: # I want to replace all values of this array
- 1
- 2
Overlay:
overlay: 1.0.0
info:
title: Array replacement test
version: 0.0.1
extends: array-test.yaml
actions:
- target: $['x-foo']
update:
x-bar:
- 3
- 4
The Action Object section says:
When the Overlay document is applied, the properties in the merge object replace properties in the target object with the same name
I understand this as x-foo being the "merge object", x-bar being a "property in the merge object", so the x-bar value from the overlay should replace (and not be appended to) the x-bar value in the document.
The workaround is to remove the array node then re-add it with the new values. This seems a bit verbose, but if that's the intended way to replace arrays then I'm OK with it.
actions:
- target: $['x-foo']['x-bar']
remove: true
- target: $['x-foo']
update:
x-bar:
- 3
- 4
- Ngôn ngữ chính
- JavaScript
- Star
- 123
- Fork
- 38
- Merge trung bình
- 10 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OAI/Overlay-Specification
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
OAI/Overlay-Specification#415 ·
-
update contributing guidelines to document the dev branchCó thể đã có người làm @baywet đã nhận 8 ngày trước. Đang mở
OAI/Overlay-Specification#418 · 1 người được giao ·
-
Revisit: should Overlays declare their target document format? (follow-up to #268)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OAI/Overlay-Specification#367 · 3 bình luận · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OAI/Overlay-Specification#358 · 2 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OAI/Overlay-Specification#299 · 2 bình luận ·
Tất cả issue của OAI/Overlay-Specification
Issue tương tự
-
Instagram explore page issueĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
enhancement good first issue hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
BinaryBaconLabs/todo-app#14 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liberation-data/drivine#428 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
celestiary/web#345 ·
Maintainer thường phản hồi trong vòng 1 ngày