liveBook · Manning

Schema

As explained in Automating API Delivery

A schema is a formal description of the structure, data types, properties, and constraints of data exchanged by an API.

An OpenAPI schema formally describes the data type and structure of an API parameter, request, or response in human- and machine-readable form. It can define primitives, arrays, and objects, then constrain required fields, properties, formats, lengths, and additional fields. section 7.1

Constrained Product response

A Product response can require an id string in UUID format, allow an optional name string between 1 and 50 characters, and reject undeclared properties with additionalProperties: false. A schema test compares the actual response with these rules and can also check its content type and headers. section 7.1

      responses:
        "200":
          description: OK     #1
          content:
            application/json:     #2
              schema:     #3
                title: Product
                required:   
                  - id
                type: object
                additionalProperties: false     #4
                properties:
                  id:
                    type: string
                    format: uuid
                    description: Identifier for the product.
                    example: dcd53ddb-8104-4e48-8cc0-5df1088c6113
                  name:
                    maxLength: 50
                    minLength: 1
                    type: string
                    description: Name of the product.
                    example: “Acme Uber Dog Rope Toy”

Inspect the OpenAPI response definition showing required fields, property types, UUID formatting, length constraints, examples, and additionalProperties: false. section 7.1

Schemas support automated response testing and validation of client-submitted data. Tightening additionalProperties can help ensure every returned field is documented and limit unexpected data exposure, but may make API evolution rigid; OpenAPI 3.0 defaults it to true. section 7.1 section 10.2.4

How Automating API Delivery covers it

How deep it goes
Explains types, properties, formats, lengths, required fields, and additionalProperties, then notes evolution trade-offs without covering unevaluatedProperties in detail.
Examples
Uses a Product response with UUID and string-length constraints, plus lint findings for undocumented and potentially sensitive response fields.
What you can do after
Apply OpenAPI schemas to validate client data, test API responses, and identify undocumented response properties.
How it connects
Connects OpenAPI schemas with JSON Schema, schema testing, API validation, and API linting.

Also explained in

Compare how 44 books explain schema →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Automating API Delivery. The section links point to the parts of the book it draws on.