Repository navigation
Conversation
Decisions: - The documents declare OpenAPI 3.1, whose JSON Schema 2020-12 schemas ignore nullable, so these fields rejected null - Flow form type: [X, 'null'], the form contacts and email-sending already use - Three array items lose the keyword instead: they are never null, and a nullable item would make generators type the elements as optional - The item beside a $ref never took effect, not even under 3.0, which ignores $ref siblings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - An unknown keyword is valid in a 3.1 schema, so the built-in rules let nullable through - The rule reads the unresolved documents, or a nullable beside a $ref vanishes with the resolved ref Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review |
Action performed
|
Decisions: - The account accesses endpoints return the token's expires_at as stored, so a token that never expires comes back as null, as the other API token schemas already allow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - 3.2 schemas are JSON Schema 2020-12 as in 3.1, so a rule scoped to 3.1 alone would stop firing without notice once the specs move to 3.2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - A Sandbox message not sent from a template has a null template_id, like its template_variables - Email Logs render custom_variables and template_variables as null when the stored message has none - The examples of messages sent without a template show null instead of 0 or an empty object Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - Naming oas3.2 makes Spectral releases older than its 1.9.0 formats package refuse the whole ruleset - oas3 also covers 3.2 and loads on any version; every spec here is 3.1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Motivation
Every spec declares
openapi: 3.1.0, but 47 schemas still marked nulls with the OpenAPI 3.0nullable: true. OpenAPI 3.1 schemas are JSON Schema 2020-12, which has nonullableand ignores unknown keywords, so those fields rejectednull. A response validator fails real responses, such as an API token that never expires (expires_at: null), and SDK generators that read the specs as 3.1 type the fields as non-null. The lint couldn't catch it either, because an unknown keyword is valid in a 3.1 schema.Changes
50 fields that can be null are now typed
[<type>, 'null'], the form contacts and email-sending already use, so they acceptnullunder 3.1expires_aton API tokens, in responses and in the create and reset request bodies, and on the API token in account accesses, which had nonullableat allparams, and the contact exporturlsubject,rfc_message_id,in_reply_to,thread_id,client_ip,category,custom_variables,template_idandtemplate_variableson messages (list and single),next_page_cursor, and the IP, MX, provider, URL and reason fields of the delivery, open, click, bounce, spam, unsubscribe and reject event detailscontent_idandtransfer_encoding, messagetemplate_idandtemplate_variables, and sandboxpasswordandlast_message_sent_atformat(date-time,uri,uuid) stays: JSON Schema applies it to strings only, sonullstill passesthree array items drop
nullableinstead of gaining a null type: the Sandbox spam reportDetailsitems, the HTML analysiserrorsitems and a project'ssandboxesitems. The API never sends them as null, and a nullable item would make generators type the arrays as lists of optional values. Thesandboxesone sits next to a$ref, so it never took effect, even under 3.0a Spectral rule,
no-nullable-keyword, fails the lint on anynullablein an OpenAPI 3.x spec, so the keyword can't come back. It matchesoas3rather than the 3.1 and 3.2 formats, which Spectral can't load before version 1.9.0 of its formats package, and every spec here is 3.1. It reads the specs unresolved, so anullablenext to a$refis caught tooHow to test
main's specs with this branch's.spectral.yaml(npx @stoplight/spectral-cli lint "specs/*.openapi.yml" --ruleset <this branch>/.spectral.yaml). Expect 47no-nullable-keyworderrors: 4 in account management, 3 in contacts, 30 in email sending and 10 in sandboxexpires_atshows as nullable on the API token responses, on the create and reset request bodies, and on the API token in the account accesses responsesubject,category,custom_variables,template_idandtemplate_variables, and the list'snext_page_cursor, show as nullablecontent_id, a message'stemplate_idand a sandbox'slast_message_sent_atshow as nullable, while the spam reportDetailsand analysiserrorsitems don'tSummary by CodeRabbit
nullablekeyword in OpenAPI 3.1 documents and recommends includingnullin the type.