Files
Vishesh 'ironeagle' Bangotra 40d91bc52b feat(scaffold): add model-backed CRUD service template
Provides a complete OpenAPI-first CRUD example with a Pydantic
model layer, explicit runtime semantics, and integration tests
to support developer onboarding and real-world service structure.
2026-01-10 18:05:39 +05:30

117 lines
2.5 KiB
YAML

openapi: 3.0.3
info:
title: Model CRUD Example Service
version: "1.0.0"
description: OpenAPI-first CRUD service with Pydantic models.
paths:
/items:
get:
operationId: list_items
responses:
"200":
description: List of items
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Item"
post:
operationId: create_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
parameters:
- name: item_id
in: path
required: true
schema:
type: integer
responses:
"200":
description: Item found
content:
application/json:
schema:
$ref: "#/components/schemas/Item"
"404":
description: Item not found
put:
operationId: update_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"
"404":
description: Item not found
delete:
operationId: delete_item
parameters:
- name: item_id
in: path
required: true
schema:
type: integer
responses:
"204":
description: Item deleted
"404":
description: Item not found
components:
schemas:
Item:
type: object
required: [id, name, price]
properties:
id:
type: integer
name:
type: string
price:
type: number
format: float
ItemCreate:
type: object
required: [name, price]
properties:
name:
type: string
price:
type: number
format: float