It looks like you’re talking about a specific use case/library. The API definition just describes your API – what your server replies depends on… your server.
From: <[email protected]> on behalf of Frank Blau <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Monday, September 11, 2017 at 16:40 To: Swagger <[email protected]> Subject: Understanding RESPONSE schema In my swagger.yaml, I define a response schema, in my case it is just a success schema: cfResponse: type: "object" required: [ "distance", "tonnage", "transportMode", "CarbonFootprint" ] properties: distance: type: "integer" description: "Distance" tonnage: type: "integer" description: "Tonnage" transportMode: type: "string" description: "Transport Mode" CarbonFootprint: type: "integer" description: "The Carbon Footprint" In my client code I send back a res.json: res.json({"distance":km, "tonnage":tonnage, "transportMode": tm, "CarbonFootrint": cf}); When I run it, I get the proper response: { "distance": 5, "tonnage": 5, "transportMode": "roadTransport", "CarbonFootrint": 1550 } But I can change the res,json to anything I want, like: res.json({"dist":km, "tonnage":tonnage, "transportMode": tm, "CarbonFootrint": cf}); and then it returns: { "dist": 5, "tonnage": 5, "transportMode": "roadTransport", "CarbonFootrint": 1550 } which does not match the response schema. I thought the purpose of the response schema was to provide ONE response schema that the client had to conform to or it would generate an error. What am I missing here? Thanks so much! -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
