{"openapi":"3.1.0","info":{"title":"Modular Monolith E-commerce API","description":"REST API for product reads, order placement, order lookup, and payment lookup.","contact":{"name":"Portfolio project","url":"https://github.com/DanieleMasone/modular-monolith-ecommerce"},"version":"0.1.0"},"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/api/orders":{"post":{"tags":["order-controller"],"summary":"Place an order","description":"Reserves catalog stock, persists the order, and publishes an internal order placed event. When Idempotency-Key is provided, safe retries return the original order.","operationId":"placeOrder","parameters":[{"name":"Idempotency-Key","in":"header","description":"Optional retry key. Reusing the same key with the same request returns the original order.","required":false,"schema":{"type":"string","default":""}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceOrderRequest"}}},"required":true},"responses":{"200":{"description":"Idempotent replay returned the original order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderDto","additionalProperties":{"default":""},"default":""}}}},"201":{"description":"Order placed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderDto","additionalProperties":{"default":""},"default":""}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Product not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Insufficient stock or idempotency conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/products":{"get":{"tags":["product-controller"],"summary":"List products","description":"Returns the catalog read model used by customers when selecting products.","operationId":"products","responses":{"200":{"description":"Products returned","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProductResponse"}}}}}}}},"/api/products/{id}":{"get":{"tags":["product-controller"],"summary":"Find a product","description":"Returns one catalog read model projection by product id.","operationId":"product","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Product found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ProductResponse","additionalProperties":{"default":""},"default":""}}}},"404":{"description":"Product not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/payments/{orderId}":{"get":{"tags":["payment-controller"],"summary":"Find payment result","description":"Returns the payment attempt created by the order placed event listener.","operationId":"findByOrderId","parameters":[{"name":"orderId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Payment attempt found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentDto","additionalProperties":{"default":""},"default":""}}}},"404":{"description":"Payment attempt not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/orders/{id}":{"get":{"tags":["order-controller"],"summary":"Find an order","description":"Returns a persisted order without exposing payment implementation details.","operationId":"findOrder","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Order found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderDto","additionalProperties":{"default":""},"default":""}}}},"404":{"description":"Order not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"components":{"schemas":{"ApiError":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code"},"message":{"type":"string","description":"Human-readable error message"}},"required":["code","message"]},"PlaceOrderRequest":{"type":"object","properties":{"productId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32","minimum":1}},"required":["productId","quantity"]},"OrderDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"productId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32"},"status":{"type":"string","enum":["PLACED"]},"createdAt":{"type":"string","format":"date-time"}}},"ProductResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"sku":{"type":"string"},"name":{"type":"string"},"price":{"type":"number"},"availableQuantity":{"type":"integer","format":"int32"}}},"PaymentDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orderId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["AUTHORIZED","DECLINED"]},"requestedAt":{"type":"string","format":"date-time"}}}}}}