typespec1-1 Exercise 2: Adding an Optional Property ========================================================== books_v2.tsp differs from books_v1.tsp in one line: model Book { id: string; title: string; pages: int32; isbn?: string; <- added } Compiled both and compared the generated OpenAPI (diff of the two openapi.yaml files): 67a68,69 > isbn: > type: string WHAT CHANGED A new property, isbn, of type string, appears under the Book schema's properties. WHAT DID NOT CHANGE The 'required' list: id, title and pages are still the only required properties. The question mark (isbn?) is what makes a property optional, and in OpenAPI that means 'not in the required list'. Nothing else in the 67 lines moved: the three operations reference the Book schema, so they pick up the new property automatically. WHY THIS WORKS AS AN ANSWER --------------------------- One edit to the model changed the one place the schema is described, and the diff shows exactly that: two added lines. In a hand-written document the same change would be made in the schema, and anywhere the shape had been written out inline, with nothing to tell you if you missed one. It is also a compatible change for existing clients (a new optional field), a distinction chapter 7 will use.