GET /feedback/rate as one of your endpoints (free, unprotected), show the rating step in your guidance, and show feedback_id in your response schemas. Rating becomes part of the plan before the call.
Two ways to wire it
- Intercept your route (default)
- Give Forge the document
If you already serve Other paths:
GET /openapi.json, do nothing. Forge buffers that response and serves an enriched copy. This works with res.json, res.send, express.static and sendFile, and handles conditional requests and Content-Length.openapi: { paths: ["/openapi.json", "/.well-known/openapi.json"] }.openapi: false.
What’s added
- Paths:
GET /feedback,POST /feedback,GET /feedback/rateandGET /feedback/summary, withsecurity: [] - Paid operations (a
402response orx-payment-info): optionalfeedback_id,feedback_urlandrate_this_callon 2xx JSON response schemas and onx-payment-info.outputSchema, plus the sentence in the operation description - Guidance: the sentence appended to
info.x-guidance(or rootx-guidance) - Marker: a root
x-forge-feedbackobject, so enriching twice changes nothing
Rules
- Additive only. Nothing is removed or reordered, and your input object is never mutated.
- Shared components are never edited. A paid response that uses
$refgets an inline, extended copy. - Strict schemas are respected. If a schema can’t safely take extra fields (
oneOf/anyOf, strictallOfmembers,propertyNames,maxProperties, an existingfeedback_id), it’s left alone, and that operation gets the header only. - Your paths win. If you already define
/feedback, nothing is overwritten. UsebasePathto move Forge’s routes. - Server prefixes are handled (
servers[0], or Swaggerhost+basePath). - Fail-safe. YAML, compressed or oversized bodies, unknown versions and any internal error are served byte-for-byte as they were.