Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-docgen

Documentation publishing for Pudu: articles, API references, navigation, search, and static websites

0.1.0Apache-2.01

InstallClose

inventory-service.yml

YAML220 lines6.2 KB

GitHub ↗
1openapi: 3.0.32info:3  title: Inventory Service4  version: 1.2.05  description: |6    A sample HTTP API that keeps stock levels for a warehouse. It is published on this site to7    show how an OpenAPI description becomes a reference page. The service is illustrative and8    is not deployed.910    Quantities are whole units. Every change is recorded as a **movement**: a receipt, a sale,11    or a count. See the [HTTP API reference guide](http-api.md) for how this page is produced.12servers:13  - url: https://inventory.example.com/v114  - url: https://staging.inventory.example.com/v115tags:16  - name: Items17    description: Stock keeping units and their quantities.18  - name: Movements19    description: Receipts, sales, and counts that change quantities.20paths:21  /items:22    get:23      operationId: listItems24      summary: List items25      description: Returns items in SKU order, one page at a time.26      tags: [Items]27      parameters:28        - name: after29          in: query30          required: false31          description: Return items whose SKU sorts after this value.32          schema:33            type: string34        - name: limit35          in: query36          required: false37          description: Largest number of items to return, from 1 to 200.38          schema:39            type: integer40            format: int3241      responses:42        '200':43          description: A page of items.44          content:45            application/json:46              schema:47                $ref: '#/components/schemas/ItemPage'48    post:49      operationId: createItem50      summary: Create an item51      description: Registers a new SKU with a quantity of zero.52      tags: [Items]53      requestBody:54        required: true55        content:56          application/json:57            schema:58              $ref: '#/components/schemas/NewItem'59      responses:60        '201':61          description: The item was created.62          content:63            application/json:64              schema:65                $ref: '#/components/schemas/Item'66        '409':67          description: An item with this SKU already exists.68          content:69            application/json:70              schema:71                $ref: '#/components/schemas/Problem'72  /items/{sku}:73    get:74      operationId: getItem75      summary: Get an item76      tags: [Items]77      parameters:78        - name: sku79          in: path80          required: true81          description: The stock keeping unit.82          schema:83            type: string84      responses:85        '200':86          description: The item.87          content:88            application/json:89              schema:90                $ref: '#/components/schemas/Item'91        '404':92          description: No item has this SKU.93          content:94            application/json:95              schema:96                $ref: '#/components/schemas/Problem'97    delete:98      operationId: retireItem99      summary: Retire an item100      description: Retires an item whose quantity is zero. Retired items keep their history.101      tags: [Items]102      deprecated: false103      parameters:104        - name: sku105          in: path106          required: true107          description: The stock keeping unit.108          schema:109            type: string110      responses:111        '204':112          description: The item was retired.113        '409':114          description: The item still has stock.115  /items/{sku}/movements:116    post:117      operationId: recordMovement118      summary: Record a movement119      description: Applies a receipt, sale, or count to an item and returns the new quantity.120      tags: [Movements]121      parameters:122        - name: sku123          in: path124          required: true125          description: The stock keeping unit.126          schema:127            type: string128        - name: Idempotency-Key129          in: header130          required: false131          description: A client-chosen key that makes retries safe.132          schema:133            type: string134      requestBody:135        required: true136        content:137          application/json:138            schema:139              $ref: '#/components/schemas/Movement'140      responses:141        '200':142          description: The item after the movement.143          content:144            application/json:145              schema:146                $ref: '#/components/schemas/Item'147        '422':148          description: A sale would make the quantity negative.149          content:150            application/json:151              schema:152                $ref: '#/components/schemas/Problem'153components:154  schemas:155    Item:156      type: object157      description: One stock keeping unit and the quantity on hand.158      required: [sku, quantity]159      properties:160        sku:161          type: string162          description: The stock keeping unit.163        name:164          type: string165          description: A display name.166        quantity:167          type: integer168          format: int64169          description: Units on hand.170    NewItem:171      type: object172      description: The fields of an item to create.173      required: [sku]174      properties:175        sku:176          type: string177          description: The stock keeping unit.178        name:179          type: string180          description: A display name.181    ItemPage:182      type: object183      description: One page of items.184      required: [items]185      properties:186        items:187          type: array188          description: Items in SKU order.189          items:190            $ref: '#/components/schemas/Item'191        next:192          type: string193          description: The value to pass as `after` for the next page, absent on the last page.194    Movement:195      type: object196      description: A change to an item's quantity.197      required: [kind, quantity]198      properties:199        kind:200          $ref: '#/components/schemas/MovementKind'201        quantity:202          type: integer203          format: int64204          description: Units received or sold, or the counted quantity.205    MovementKind:206      type: string207      description: What a movement does to the quantity.208      enum: [received, sold, counted]209    Problem:210      type: object211      description: An error response.212      required: [code, message]213      properties:214        code:215          type: string216          description: A stable error code.217        message:218          type: string219          description: A readable explanation.220