Files
Vishesh 'ironeagle' Bangotra 2ac342240b feat(templates): add OpenAPI-first CRUD app scaffold with mock data
- include CRUD OpenAPI spec
- add in-memory mock data store
- implement OpenAPI-bound route handlers
- provide runnable FastAPI bootstrap
- include end-to-end integration test
2026-01-10 17:59:11 +05:30

116 lines
2.5 KiB
YAML

openapi: 3.0.3
info:
title: CRUD Example Service
version: "1.0.0"
description: Minimal OpenAPI-first CRUD service with in-memory mock data.
paths:
/items:
get:
operationId: list_items
summary: List all items
responses:
"200":
description: List of items
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Item"
post:
operationId: create_item
summary: Create a new item
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ItemCreate"
responses:
"201":
description: Item created
content:
application/json:
schema:
$ref: "#/components/schemas/Item"
/items/{item_id}:
get:
operationId: get_item
summary: Get item by ID
parameters:
- name: item_id
in: path
required: true
schema:
type: integer
responses:
"200":
description: Item found
content:
application/json:
schema:
$ref: "#/components/schemas/Item"
put:
operationId: update_item
summary: Update an item
parameters:
- name: item_id
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ItemCreate"
responses:
"200":
description: Item updated
content:
application/json:
schema:
$ref: "#/components/schemas/Item"
delete:
operationId: delete_item
summary: Delete an item
parameters:
- name: item_id
in: path
required: true
schema:
type: integer
responses:
"204":
description: Item deleted
components:
schemas:
Item:
type: object
properties:
id:
type: integer
name:
type: string
price:
type: number
format: float
required: [id, name, price]
ItemCreate:
type: object
properties:
name:
type: string
price:
type: number
format: float
required: [name, price]