openapi: 3.1.0
info:
  title: Portable counter
  version: 1.0.0
  description: A minimal illustrative contract; adapt the domain with your agent.
  x-reading-mode: interpret + read
  x-conventions:
    name: xd-contract
    version: "1.0"
    url: https://documentationfirst.ai/xd-contract.html
  x-params:
    maximum: 100
paths:
  /counter:
    get:
      operationId: readCounter
      description: Return the current non-negative counter.
      x-postconditions:
        - response.value >= 0
      responses:
        "200":
          description: Current counter
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Counter"
components:
  schemas:
    Counter:
      type: object
      required: [value]
      properties:
        value:
          type: integer
          minimum: 0
          description: Current counter value.
      x-invariants:
        - self.value >= 0
