typespec1-11 Exercise 1: A Compatible Change to a Published Version =========================================================================== The change (branch ex1-subtitle, in the scratch repository), added to the Book model: /** A subtitle, when the book has one. */ @added(Versions.v2) subtitle?: string; Regenerated and committed. Summary of the pull request: api/main.tsp | 3 +++ api/openapi/openapi.2.0.yaml | 6 ++++++ api/openapi/openapi.3.0.yaml | 6 ++++++ 3 files changed, 15 insertions(+) ci.sh: PASS tsp format --check PASS tsp compile --warn-as-error PASS generated OpenAPI is committed PASS no breaking change vs main ALL CHECKS PASSED oasdiff changelog, main's openapi.2.0.yaml against the branch's (first 12 lines): 4 changes: 0 error, 0 warning, 4 info info [response-optional-property-added] at api/openapi/openapi.2.0.yaml in API GET /books added the optional property `items/subtitle` to the response with the `200` status info [new-optional-request-property] at api/openapi/openapi.2.0.yaml in API POST /books added the new optional request property `subtitle` info [response-optional-property-added] at api/openapi/openapi.2.0.yaml in API POST /books added the optional property `subtitle` to the response with the `200` status IT PASSES. oasdiff reported 4 changes, all 'info': an optional property added to two responses (GET /books and POST /books) and a new optional request property on POST /books. NOTE what else changed: openapi.3.0.yaml also gained six lines, because version 3 contains everything version 2 does, so the new property appears in both published files. WOULD I ACCEPT IT? By the script's definition of 'breaking', yes. By the habit that a published version is a promise, I would ask for it to go into the next version instead. The reasons it is compatible are real (optional, and a client that ignores unknown properties is unaffected), but a client that validates responses strictly against the version 2 file, or a generated client with a closed model, could see a difference; I did not test either. The script cannot decide this: it is a policy choice, which is why Exercise 2 exists. WHY THIS WORKS AS AN ANSWER --------------------------- It records a case the check passes and a human might still question, and says what I did and did not check.