feat(oas): add object-with-properties-requires-type-object rule#2961
feat(oas): add object-with-properties-requires-type-object rule#2961slegarraga wants to merge 1 commit into
Conversation
|
@maintainers Friendly nudge — rolling review welcome. Rule is opt-in ( |
|
Ready for review when you have bandwidth — mergeable, Wiz CI green, tests added. Closes #2203. Thanks. |
|
@tomek-tursa-sb Hi — you merged #2934 last week; this follow-up adds the opt-in rule from #2203 (tests + docs). Mergeable, Wiz green. A review when you have a cycle would be appreciated. Thanks. |
|
Local jest on rule tests: 5/5 pass. Branch is mergeable; let me know if you want this marked |
|
Related: #2962 (OAS 3.1 bearer scopes) — same ruleset area if useful to batch review. |
|
Ready for merge — closes #2203, MERGEABLE, CI summary ✅, local rule tests pass. Opt-in rule (not |
|
@tomek-tursa-sb Batch review request when you have a cycle — three small Spectral PRs from the same contributor window:
All MERGEABLE, Wiz green. #2963 overlaps #2960 — land either for the null guard. Thanks again for merging #2934. |
Adds an opt-in builtin rule for schemas that define properties without declaring type: object, addressing a common OpenAPI footgun. Closes stoplightio#2203
0c521f2 to
08567e8
Compare
Summary
Implements the builtin rule proposed in #2203: schemas that define
propertiesmust also declaretype: object.object-with-properties-requires-type-objectrecommended: false(opinionated; opt-in like other style rules)resolved: false(type belongs on the schema node, not on$reftargets)Why
Without
type: object, JSON Schema validation does not restrict instances to objects — strings/booleans can pass unexpectedly when onlypropertiesis set.Test plan
yarn jest packages/rulesets/src/oas/__tests__/object-with-properties-requires-type-object.test.tsCloses #2203
Made with Cursor